|
|
|
>>>> lismenu 4ชั้นครับ <<<< จากตัวนี้จะเป็น listmenu แบบ 3 ชั้นคือ ภูมิภาค >> จังหวัด >> อำเภอ |
|
|
|
|
|
|
|
ทำความเข้าใจ 3 ชั้นให้ทะลุปรุโปร่ง แล้วก็จะทำ 4 ชั้นได้เองครับ
|
|
|
|
|
Date :
2010-07-27 16:01:14 |
By :
DownsTream |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองทำแล้วครับมันออกมาแค่3ครับ แต่4ไม่ออกช่วยดูให้หน่อยได้ไหมครับ
</script>
<script language = "JavaScript">
//**** List Province (Start) ***//
function ListTb_subtype(SelectValue)
{
frmMain.tb_subtype.length = 0
frmMain.tb_showbrand.length = 0
frmMain.tb_product.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.tb_subtype.options[frmMain.tb_subtype.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tb_subtype ORDER BY id_subtype ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup1 = <?=$objResult["ref_id_type"];?>;
strValue = "<?=$objResult["id_subtype"];?>";
strItem = "<?=$objResult["name_subtype"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup1;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.tb_subtype.options[frmMain.tb_subtype.length]= myOption
}
<?
}
?>
}
//**** List Province (End) ***//
//**** List Amphur (Start) ***//
function ListTb_showbrand(SelectValue)
{
frmMain.tb_showbrand.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.tb_showbrand.options[frmMain.tb_showbrand.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tb_showbrand ORDER BY id_showbrand ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup2 = <?=$objResult["ref_id_subtype"];?>;
strValue = "<?=$objResult["id_showbrand "];?>";
strItem = "<?=$objResult["name_brand1"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup2;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.tb_showbrand.options[frmMain.tb_showbrand.length]= myOption
}
<?
}
?>
}
//**** List Amphur (End) ***//
function ListTb_product(SelectValue)
{
frmMain.tb_product.length = 0
//*** Insert null Default Value ***//
var myOption = new Option('','')
frmMain.tb_product.options[frmMain.tb_product.length]= myOption
<?
$intRows = 0;
$strSQL = "SELECT * FROM tb_product ORDER BY name_product ASC ";
$objQuery = mysql_db_query($dbname, $strSQL);
$intRows = 0;
while($objResult = mysql_fetch_array($objQuery))
{
$intRows++;
?>
x = <?=$intRows;?>;
mySubList = new Array();
strGroup3 = <?=$objResult["ref_id_showbrand"];?>;
strValue = "<?=$objResult["id_product"];?>";
strItem = "<?=$objResult["name_product"];?>";
mySubList[x,0] = strItem;
mySubList[x,1] = strGroup3;
mySubList[x,2] = strValue;
if (mySubList[x,1] == SelectValue){
var myOption = new Option(mySubList[x,0], mySubList[x,2])
frmMain.tb_product.options[frmMain.tb_product.length]= myOption
}
<?
}
?>
}
</script>
|
|
|
|
|
Date :
2010-07-27 16:07:50 |
By :
teekaiman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอคุณครับ ทำได้แล้วครับผม
|
|
|
|
|
Date :
2010-07-27 16:33:42 |
By :
teekaiman |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2010-08-18 16:15:04 |
By :
noonu_haha |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|