我有这样一个函数,做为链接到下一个页面,并有三个值需传递,代码如下:
<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 这样可以传到下一个页面,这样写的方式不能通过,请问应该怎样写。
<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 这样可以传到下一个页面,这样写的方式不能通过,请问应该怎样写。
<script language="javascript">
function search()
{
window.location="saleticket2.asp?playdate=<%=thedate%>&playtimeid=<%=theplaytimeid%>&salenumber=" + document.getElementById("selectedticketnumber").value+ "&cl=3";
;
}
</script>
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
theplaytimeid+"salenumber=" theplaytimeid+"&salenumber="
这两句是什么意思啊?
我只知道这样写有问题,但不清楚要怎么修改 。。
链接地址成了这样:
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
因刚才做修改时没有保存就运行了,所以出现现象不正确。
he_8134 提出的修改
theplaytimeid+"salenumber="
theplaytimeid+"&salenumber="
修改后还是不能链接,按下时左下角提示网页上有错误。
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';
我直接拷的你原帖
用这个方法按下时左下角提示网页上有错误。不能链接到下一个页面。
<%
thedate=request("playdate")
theplaytimeid=request("playtimeid")
%>
function search()
{
window.location="saleticket2.asp?playdate=<%=thedate%>&playtimeid=<%=theplaytimeid%>&salenumber=" + document.getElementById("selectedticketnumber").value + "&cl=3";
;
}
</script> 这样没错啊。