日期:2014-05-16  浏览次数:20314 次

求助在线等,请大侠们帮帮忙,在ff上运行正常,ie上不行
html文件
JScript code

<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>




VBScript code

<%
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    
%>

ie中运行结果是
<select>
第一条</option><option>diertiao</option><option>33333</option></select>

ff中运行是<select>
<option>第一条</option><option>diertiao</option><option>33333</option></select>
ie中不正常
方法中正常,要怎么处理呢

------解决方案--------------------
xmlhttp.send("");s
这句后面多了一个s了。
------解决方案--------------------
探讨

没有人吗??
很急的啊!!!!!!
谢谢 啊

------解决方案--------------------
IE下select不支持修改innerHTML, 可以外面加个div,然后替换整个select的内容

参考:http://blog.csdn.net/grubbyfan/article/details/3743344