js innerHTML未知的运行时错误

时间:2022-11-17 12:20:23
<html><head><title>凱宸房仲網</title>
<meta name="keywords" content="凱宸房仲網">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="CSS/css.css">

<!--開始顯示-->
<body>
<div width=100px height=20px style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;顯示方式:<A  href="<%=LinkPage%>page=<%=page%>&display=hor"><IMG height=18
    src="images/view_mode_10a.gif" width=18 border=0 id="img1"></A>&nbsp;&nbsp;<A  href="<%=LinkPage%>page=<%=page%>&display=ver"><IMG height=18 src="images/view_mode_10a1.gif" width=18 border=0 id="img1"></A></div>
    <div width=300px height=20px style="float:right"><div style="width:60px;height:20px;float:left;">排序方式:</div>
    <div id=ordmon style="width:50px;height:20px;float:left;"><a href=House_List.asp?><font color=#4169e1>按金額</font><a></div><div  id=ordmoney><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordmon","ordmoney","up","按金額")></div></div>
    <div id=ordhouse style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按房數</font><a></div><div  id=ordfang><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordhouse","ordfang","up","按房數")></div></div>
    
    <div id=orddp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按地坪</font><a></div><div id=orddp1><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("orddp","orddp1","up","按地坪")></div></div>
    <div id=ordjp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按建坪</font><a></div><div id=ordjp1><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left" onclick=sel("ordjp","ordjp1","up","按建坪")></div></div>
    <div id=ordtime style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按時間</font><a></div><div id=ordtime1><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordtime","ordtime1","up","按時間")></div></div></div>
<SCRIPT language=JavaScript type=text/javascript>
function sel(divmain,divname,updown,str){
   var str1,strstr;
  //var str=document.getElementById("ranksel").options[document.getElementById("ranksel").options.selectedIndex].value;
  //alert(divmain+"--"+divname+"--"+updown+"--"+str);
  //alert(document.getElementById(divmain).innerHTML);
  if(updown=="up"){
     str1="<a href='House_List.asp?'><font color=#4169e1>"+str+"</font></a>";
     alert(str1);
     document.getElementById(divmain).innerHTML=str1;
     strstr="<div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left'></div><div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','down','"+str+"')></div>";
     document.getElementById(divname).innerHTML=strstr;
     //alert(strstr);
  }else{
     document.getElementById(divmain).innerHTML="<a href='House_List.asp?'><font color=#4169e1>"+str+"</font></a>";
     strstr="<div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left'></div><div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','up','"+str+"')></div>";
     document.getElementById(divname).innerHTML=strstr;
  }
}
</SCRIPT>

</BODY></HTML>

图片地址:http://www.5epe.com/images/up_down.gif

点第一个箭头,不管怎样点都没问题,但从第二个到最后一个,点向下的箭头网页总是提醒第26行,未知的运行时错误。调试许久,不知怎么解决,望大侠帮忙。

3 个解决方案

#1


太复杂了 只能帮你顶一下了

#2


js没问题,是html不标准,按XXX后面的</a>写成<a>了

<html> <head> <title>凱宸房仲網 </title> 
<meta name="keywords" content="凱宸房仲網"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<link rel="stylesheet" type="text/css" href="CSS/css.css"> 

<!--開始顯示--> 
<body> 
<div width=100px height=20px style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;顯示方式: <A href="<%=LinkPage%>page= <%=page%>&display=hor"><IMG height=18 
    src="images/view_mode_10a.gif" width=18 border=0 id="img1"> </A>&nbsp;&nbsp; <A href="<%=LinkPage%>page= <%=page%>&display=ver"><IMG height=18 src="images/view_mode_10a1.gif" width=18 border=0 id="img1"> </A> </div> 
    <div width=300px height=20px style="float:right"><div style="width:60px;height:20px;float:left;">排序方式: </div> 
    <div id=ordmon style="width:50px;height:20px;float:left;"><a href=House_List.asp?><font color=#4169e1>按金額</font></a></div> <div  id=ordmoney><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordmon","ordmoney","up","按金額")></div></div> 
    <div id=ordhouse style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按房數</font></a></div><div id=ordfang> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordhouse","ordfang","up","按房數")></div></div> 
    <div id=orddp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按地坪</font></a></div><div id=orddp1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("orddp","orddp1","up","按地坪")></div> </div> 
    <div id=ordjp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按建坪</font></a></div><div id=ordjp1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left" onclick=sel("ordjp","ordjp1","up","按建坪")></div></div> 
    <div id=ordtime style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按時間</font></a></div><div id=ordtime1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordtime","ordtime1","up","按時間")></div></div></div> 
<SCRIPT language=JavaScript type=text/javascript> 
function sel(divmain,divname,updown,str){ 
  var str1,strstr; 
  //var str=document.getElementById("ranksel").options[document.getElementById("ranksel").options.selectedIndex].value; 
  //alert(divmain+"--"+divname+"--"+updown+"--"+str); 
  //alert(document.getElementById(divmain).innerHTML); 
  if(updown=="up"){ 
    str1=" <a href='House_List.asp?'> <font color=#4169e1>"+str+" </font> </a>"; 
    document.getElementById(divmain).innerHTML=str1; 
    strstr=" <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left'> </div> <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','down','"+str+"')> </div>"; 
    document.getElementById(divname).innerHTML=strstr; 
    //alert(strstr); 
  }else{ 
    document.getElementById(divmain).innerHTML=" <a href='House_List.asp?'> <font color=#4169e1>"+str+" </font> </a>"; 
    strstr=" <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left'> </div> <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','up','"+str+"')> </div>"; 
    document.getElementById(divname).innerHTML=strstr; 
  } 

</SCRIPT> 

</BODY> </HTML>

#3


万分感谢,果真如此,谢谢了!
只怪我太粗心了。

#1


太复杂了 只能帮你顶一下了

#2


js没问题,是html不标准,按XXX后面的</a>写成<a>了

<html> <head> <title>凱宸房仲網 </title> 
<meta name="keywords" content="凱宸房仲網"> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> 
<link rel="stylesheet" type="text/css" href="CSS/css.css"> 

<!--開始顯示--> 
<body> 
<div width=100px height=20px style="float:left">&nbsp;&nbsp;&nbsp;&nbsp;顯示方式: <A href="<%=LinkPage%>page= <%=page%>&display=hor"><IMG height=18 
    src="images/view_mode_10a.gif" width=18 border=0 id="img1"> </A>&nbsp;&nbsp; <A href="<%=LinkPage%>page= <%=page%>&display=ver"><IMG height=18 src="images/view_mode_10a1.gif" width=18 border=0 id="img1"> </A> </div> 
    <div width=300px height=20px style="float:right"><div style="width:60px;height:20px;float:left;">排序方式: </div> 
    <div id=ordmon style="width:50px;height:20px;float:left;"><a href=House_List.asp?><font color=#4169e1>按金額</font></a></div> <div  id=ordmoney><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordmon","ordmoney","up","按金額")></div></div> 
    <div id=ordhouse style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按房數</font></a></div><div id=ordfang> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordhouse","ordfang","up","按房數")></div></div> 
    <div id=orddp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按地坪</font></a></div><div id=orddp1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("orddp","orddp1","up","按地坪")></div> </div> 
    <div id=ordjp style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按建坪</font></a></div><div id=ordjp1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left" onclick=sel("ordjp","ordjp1","up","按建坪")></div></div> 
    <div id=ordtime style="width:50px;height:20px;float:left;">&nbsp;|&nbsp;<a href=House_List.asp?><font color=#4169e1>按時間</font></a></div><div id=ordtime1> <div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left"></div><div style="width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left" onclick=sel("ordtime","ordtime1","up","按時間")></div></div></div> 
<SCRIPT language=JavaScript type=text/javascript> 
function sel(divmain,divname,updown,str){ 
  var str1,strstr; 
  //var str=document.getElementById("ranksel").options[document.getElementById("ranksel").options.selectedIndex].value; 
  //alert(divmain+"--"+divname+"--"+updown+"--"+str); 
  //alert(document.getElementById(divmain).innerHTML); 
  if(updown=="up"){ 
    str1=" <a href='House_List.asp?'> <font color=#4169e1>"+str+" </font> </a>"; 
    document.getElementById(divmain).innerHTML=str1; 
    strstr=" <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -30px -102px;float:left'> </div> <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -55px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','down','"+str+"')> </div>"; 
    document.getElementById(divname).innerHTML=strstr; 
    //alert(strstr); 
  }else{ 
    document.getElementById(divmain).innerHTML=" <a href='House_List.asp?'> <font color=#4169e1>"+str+" </font> </a>"; 
    strstr=" <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -6px -102px;float:left'> </div> <div style='width:16px;height:16px;background:url(images/up_down.gif) no-repeat -31px -76px;float:left' onclick=sel('"+divmain+"','"+divname+"','up','"+str+"')> </div>"; 
    document.getElementById(divname).innerHTML=strstr; 
  } 

</SCRIPT> 

</BODY> </HTML>

#3


万分感谢,果真如此,谢谢了!
只怪我太粗心了。