在b.html使用function QueryString(qs)
{
var s = location.href;
s = s.replace("?","?&").split("&");
var re = "";
for(i=1;i<s.length;i++)
if(s[i].indexOf(qs+"=")==0)
re = s[i].replace(qs+"=","");
return re;
}
用法:
window.alert(location.href);
window.alert(QueryString("tid"));
window.alert(QueryString("fpage"));取的tag的值传入switch里面.

解决方案 »

  1.   

    我不是要往switch里传,我是想a.html的参数传到b.html,再在b.html中输出。
    只不过a.html传过来的参数要经过嵌套在b.html页面中的*.js文件来查找判断找出相应的值后再在b.html中输出。如:也就是a.html传出参数,b.html输出参数,c.js负责接收从a.html传过来的参数并判断及作相应的处理。  a.html中的一个链接。  <a href=b.html?tag=传递参数></a>    b.html
      <html>
      <script src="c.js"></script>
      <SCRIPT language=javascript>  
      document.write("  <center>");  
      document.write("  <table bgcolor=#FF8040 width=480>");  
      document.write("  <tr>  <td>");  
      document.write(sTag);  
      document.write("  </td>  </tr>");  
      document.write("  </table>");  
      document.write("  </center>");  
      </SCRIPT>  
      </html>
       
      c.js  
      swith (i){  
        case 0:  
           sTag="值";  
        break;  
        ...  
        case n:  
           sTag="值";  
       break;  
      }