日期:2014-05-16 浏览次数:20314 次
<select name="pid" id="pid1"> <option value='2'>Loading</option> </select> <script type="text/javascript"> function GetUrlParms() { var args=new Object(); var query=location.search.substring(1);//获取查询串 var pairs=query.split("&");//在逗号处断开 for(var i=0;i<pairs.length;i++) { var pos=pairs[i].indexOf('=');//查找name=value if(pos==-1) continue;//如果没有找到就跳过 var argname=pairs[i].substring(0,pos);//提取name var value=pairs[i].substring(pos+1);//提取value args[argname]=unescape(value);//存为属性 } return args; } window.onload=function(){ var args = new Object(); args = GetUrlParms(); var Pid=args["pid"]; if(Pid==='undefined') selec(2); else selec(Pid); } function selec(i){ if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) {document.getElementById("pid1").innerHTML=xmlhttp.responseText;alert(document.getElementById("pid1").innerHTML);} } //xmlhttp.setRequestHeader("Content-Type","text/xml;charset=gb2312"); //xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); xmlhttp.open("get","inc/headSelect.asp?pid="+(i>=0?i:-1),true); xmlhttp.send("");s } </script>
<% Response.Addheader "Content-Type","text/html; charset=gb2312" dim pid pid=request.QueryString("pid") set rss=server.CreateObject("adodb.recordset") sql="select id,title from data where parentid=1 order by id asc" rss.open sql,conn,3,1 if not rss.eof and not rss.bof then first=rss.GetRows() else end if rss.close set rss=nothing dim ssss 'if pid=-1 then ssss=" selected=""selected""" 'response.Write("<option value='-1'>查询所有</option>"&Chr(10)) for i=0 to ubound(first,2) if(first(0,i)=cint(pid)) then ssss=" selected=""selected""" else ssss="" end if response.Write("<option value="""&first(0,i)&""" "&ssss&">"&first(1,i)&"</option>"&Chr(10)) next %>