我有这样一个函数,做为链接到下一个页面,并有三个值需传递,代码如下: 
<script language="javascript">
function search()
{
    window.location="saleticket2.asp?playdate="+thedate+"&playtimeid="+theplaytimeid+"salenumber=" + document.getElementById("selectedticketnumber").value+ "&cl=3";
;
}
</script>
其中thedate, theplaytimeid 是两个变量,想将其值传递给playdate ,playtimeid 这样可以传到下一个页面,这样写的方式不能通过,请问应该怎样写。

解决方案 »

  1.   

    如果是用asp或jsp的话,直接
    <script   language="javascript"> 
    function   search() 

            window.location="saleticket2.asp?playdate=<%=thedate%>&playtimeid=<%=theplaytimeid%>&salenumber="   +   document.getElementById("selectedticketnumber").value+   "&cl=3"; 


    </script> 
      

  2.   

    theplaytimeid+"salenumber="   theplaytimeid+"&salenumber="   
      

  3.   

    qiuhjmx 的这个方法好像不行哦 链接地址成了这样:
    http://localhost/saleticket2.asp?playdate=%20%20&playtimeid=%20%20&salenumber=1&cl=3
    正常情况下是这种格式的::
    http://localhost/saleticket2.asp?playdate=1008-1-19&playtimeid=109&salenumber=1&cl=3
      

  4.   

    he_8134 
    theplaytimeid+"salenumber="       theplaytimeid+"&salenumber="  
    这两句是什么意思啊?
    我只知道这样写有问题,但不清楚要怎么修改 。。
      

  5.   

    theplaytimeid+"salenumber="               theplaytimeid+"&salenumber=" 将此处修改后出现3楼的问题。
    链接地址成了这样: 
    http://localhost/saleticket2.asp?playdate=%20%20&playtimeid=%20%20&salenumber=1&cl=3 
    正常情况下是这种格式的:: 
    http://localhost/saleticket2.asp?playdate=1008-1-19&playtimeid=109&salenumber=1&cl=3 
      

  6.   

    更正一下,
    因刚才做修改时没有保存就运行了,所以出现现象不正确。
    he_8134 提出的修改
    theplaytimeid+"salenumber="                               
    theplaytimeid+"&salenumber=" 
    修改后还是不能链接,按下时左下角提示网页上有错误。
      

  7.   


    var text= document.getElementById("selectedticketnumber").value;
    變量是JS裡的用
    window.location='saleticket2.asp?playdate='+thedate+'&playtimeid='+theplaytimeid+'salenumber='+ text+'&cl=3'; 
    變量是<%%>裡的直接寫
    window.location='saleticket2.asp?playdate='+<%=thedate%>+'&playtimeid='+<%=theplaytimeid%>+'salenumber='+ text+'&cl=3';
      

  8.   

    'salenumber要變成'&salenumber
    我直接拷的你原帖
      

  9.   

    xxhui297509157 
    用这个方法按下时左下角提示网页上有错误。不能链接到下一个页面。
      

  10.   

    thedate、theplaytimeid是什么变量?
      

  11.   

    thedate、theplaytimeid是什么变量?是这样来的:
    <%
    thedate=request("playdate")
    theplaytimeid=request("playtimeid")
    %>
      

  12.   

    <script   language="javascript"> 
    function   search() 

            window.location="saleticket2.asp?playdate=<%=thedate%>&playtimeid=<%=theplaytimeid%>&salenumber=" + document.getElementById("selectedticketnumber").value + "&cl=3"; 


    </script> 这样没错啊。