จะทำ list menu 2 ชั้นทำแล้วรันได้แต่ใน IE แต่รันใน firefox ไม่ได
ใน friefox มันฟ้องบรรทัด นี้นะ <?
session_start();
xmlHttp.onreadystatechange=handleStateChange;
////////////////////////////////////////////menu.php////////////////////////
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>menu</title>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<link href="../images/myfreetemplates.css" rel="stylesheet" type="text/css">
<?
//include("../include/checklogin.php");
include("../include/pastimages.php");
include("../include/module.php");
$App_ID = 2;
CheckApp($UID,$App_ID);
include ("../include/condb.php");
?>
<script>
var xmlHttp;
function createXMLHttpRequest() {
if (window.ActiveXObject) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if (window.XMLHttpRequest) {
xmlHttp = new XMLHttpRequest();
}
}
function list_namesub(id) {
var obj = document.getElementById("subcatalog");
var obj_default = '- Choose -';
if(id ==""){
while(obj.childNodes.length>0){obj.removeChild(obj.childNodes[0]);}
obj[0] = new Option(obj_default,'');}else{
var url = "get_subname.php?id=" + id;
createXMLHttpRequest();
xmlHttp.onreadystatechange=handleStateChange;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
function handleStateChange() {
if(xmlHttp.readyState == 4) {
if(xmlHttp.status == 200) {
var results = xmlHttp.responseText;
while(obj.childNodes.length>0){obj.removeChild(obj.childNodes[0]);}
arr_list=results.split("/");
if(arr_list.length-1!=0){
for (var i=0; i < eval(arr_list.length-1); i++) {
shop_arr=arr_list[i].split(",");
obj.options[i] = new Option(shop_arr[0],shop_arr[1]);
}}else{
while(obj.childNodes.length>0){obj.removeChild(obj.childNodes[0]);}
obj[0] = new Option(obj_default,'');
}
}
}}
}}
</script>
<script language="JavaScript">
function fromcheck(frm)
{
if(frm.thcom_name.value=="")
{
alert("กรุณาป้อนข้อมูลที่ \"Company\"");
frm.thcom_name.focus();
return(false);
}
return(true);
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
</script>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='add_company.php?link_idend="+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="155" rowspan="2"><img src="../images/toplogo.gif" width="142" height="87"></td>
<td width="34" rowspan="2"><img src="../images/topmidspace.jpg" width="34" height="87"></td>
<td background="../images/topbg.jpg"><img src="../images/topbg.jpg" width="1" height="54"></td>
</tr>
<tr>
<td background="../images/topnavbg.jpg"><img src="../images/btn.jpg"></td>
</tr>
</table>
<br> <form name="frm" method="post" action="action_company.php" onsubmit="return fromcheck(this)">
<table width="512" border="0" align="center">
<tr bgcolor= #006699>
<td colspan="2" class="fontcenter"><span class="fontcenter">Add Company</span></td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td width="103" class="fontring"><strong >Company </span></strong></td>
<td width="399" bgcolor="<?=$cform_right?>"><input name="thcom_name" type="text" class="inputbox" id="thcom_name" style="width:180px"></td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td class="fontring"><strong>Address</strong></td>
<td bgcolor="<?=$cform_right?>"><textarea name="thcom_add" id="thcom_add" cols="45" rows="5"></textarea></td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td class="fontring"><strong>Country </strong></td>
<td bgcolor="<?=$cform_right?>">
<select name="catalog" id="catalog" onChange="list_namesub(this.value);" style="width:200px">
<option value="">- Choose -</option>
<?
$sqlcountry="select * from country";
$rscountry= $conn->GetAll($sqlcountry);
foreach($rscountry as $rs)
{$country_name=$rs["country_name"];
$country_id=$rs["country_id"];
?>
<option value="<?=$rs["country_id"];?>"><?=$country_name;?></option>
<?}?>
</select>
</td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td class="fontring"><strong>Province </strong></td>
<td bgcolor="<?=$cform_right?>">
<select name="subcatalog" id="subcatalog" style="width:200px">
<option value="">- Choose -</option>
</select></td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td class="fontring"><strong>Tel </strong></td>
<td bgcolor="<?=$cform_right?>"><input name="thcom_tel" type="text" class="inputbox" id="thcom_tel" style="width:180px" maxlength="20"></td>
</tr>
<tr bgcolor="<?=$cform_left?>">
<td><img width="0" height="0"></td>
<td bgcolor="<?=$cform_right?>">
<br>
<input type="Hidden" name="Mode" value="Add">
<input style="cursor : hand;" type="submit" name="Add" value=" เพิ่ม " class="button" >
<input style="cursor : hand;" type="button" onClick="window.close();" name="Close" value=" ปิดหน้าต่างนี้ " class="button" >
<br>
</td>
</tr>
</table>
</form>
</body>
</html>
<?include ("../include/closedb.php");?>
///////////////////////////////////////////get_subname.php////////////////////////////////////////////////////
<?php
header("Content-Type: text/plain; charset=utf-8");
include ("../include/condb.php");
$sqlpro="select * from province where Province_id_cou='$id'";
$repro= $conn->GetAll($sqlpro);
foreach($repro as $rs1)
{$Province_name=$rs1["Province_name"];
$Province_id=$rs1["Province_id"];
echo"$Province_name,$Province_id/";
}
?>
xmlHttp.onreadystatechange=function(){handleStateChange(xmlHttp);}