[求助]AJAX 无刷新菜单问题 急!~~
<P>大家帮忙看看为什么不行,老有错误,而且,也老写空值<BR>-------JS 代码------------<BR>var xmlhttp=false;<BR>try{<BR> xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");<BR>}catch(e){<BR> try{<BR> xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");<BR> }catch(e2){<BR> xmlhttp=false;<BR> }<BR>}<BR>if (!xmlhttp && typeof XMLHttpRequest != 'undefined'){<BR> xmlhttp=new XMLHttpRequest();<BR>}<BR>function startRequest(){<BR> document.getElementById("class2").options.length=0;<BR> var url=document.f1.class1.value;<BR> var qurl="select_class.php?class1="+url;<BR> xmlhttp.open("GET",qurl,true);<BR> xmlhttp.send(null);<BR> xmlhttp.onreadystatechange=function(){<BR> if (xmlhttp.readyState==4){<BR> if (xmlhttp.status==200){<BR> var obj=document.getElementById("class2");<BR> eval(xmlhttp.responseText);<BR> }<BR> }<BR> }<BR>}<BR>--------HTML 代码-----------<BR>信息类别:<select name="class1" id="input_3" onChange="startRequest();"><option value="0" selected>信息类别</option><?php op_class1();?></select> &nbsp;<BR>信息分类:<select name="class2" id="class2"><option value="0">信息分类</option></select><BR>------------select_class.php文件代码------------<BR>$class1=$_GET['class1']<BR>if(isset($class1)){<BR> $rs=mysql_query("select * from class where f_classid=$class1");<BR> while($row=mysql_fetch_array($rs)){<BR> echo "obj.options[obj.options.length]=new Option('$row[1]','$row[0]');n";<BR> }<BR>}<BR></P><P>请大家帮忙看看,急!!~~,在这里谢谢了</P>
页:
[1]
