|
|
|
สอบถามเรื่อง Dependent ListMenu เมื่อกด Onchange แล้วไม่ยอมทำงาน |
|
|
|
|
|
|
|
อันนี้ในส่วนของ Javascript ที่เรียกครับ
Code (JavaScript)
<script type="text/javascript">
//**** List Dev (Start) ***//
function ListDevType(SelectValue)
{ alert("เข้ามาแล้ว");
frmMain.devType.length = 0;
frmMain.peopleList.length = 0;
//*** Insert null Default Value ***//
var myOption = new Option('','') ;
frmMain.devType.options[frmMain.devType.length]= myOption;
<?php
$intRows = 0;
$strSQL = "SELECT * FROM role ORDER BY roleID ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?php $intRows; ?>;
mySubList = new Array();
strGroup = "<?php $objResult['roleTypeID'];?>"
strValue = "<?php $objResult['roleID']; ?>"
strItem = "<?php $objResult['roleName']; ?>"
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
alert strItem;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2]);
frmMain.devType.options[frmMain.devType.length]= myOption;
}
<?php
}
?>
}
//**** List Dev(End) ***//
//**** List People (Start) ***//
function ListPeople(SelectValue)
{
frmMain.peopleList.length = 0;
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.peopleList.options[frmMain.peopleList.length]= myOption
<?php
$intRows = 0;
$strSQL = "SELECT * FROM user ORDER BY userName ASC ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?php $intRows;?>;
mySubList = new Array();
strGroup = "<?php $objResult["roleID"];?>";
strValue = "<?php $objResult["userName"];?>";
strItem = "<?php $objResult["firstName"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.peopleList.options[frmMain.peopleList.length]= myOption
}
<?php
}
?>
}
//**** List People(End) ***//
|
ประวัติการแก้ไข 2013-05-20 11:20:56
|
|
|
|
Date :
2013-05-20 11:20:13 |
By :
ouui |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|