setTimeout()參數傳遞問題?

PLMM_ 2005-11-26 01:47:49
html>
<head>
<title>send1</title>
</head>

<body>
<%
id=request("id")
isCsPower=request("isCsPower")
%>

<script language="javascript">
function opencolortext(id,isCsPower){
window.open("send_ZhuGuan2.asp?id="+id+"&isCsPower="+isCsPower,"hello");}

setTimeout("opencolortext(?,?)",3000); //?????????
</script>

正在下載文件,請耐心等待......
</body>
</html>

請問, 在setTimeout()中, 如何才能把參數id, isCsPower(上一頁傳的),傳給send_ZhuGuan2.asp???
...全文
122 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
oldmht 2005-11-26
  • 打赏
  • 举报
回复
isCsPower是什么东西,不管是什么形的,总有个规则吧
数字就是isnumeric,字符的就在js里面加引号,换行的就是把vbcrlf换成\n或者<br>
rawjim 2005-11-26
  • 打赏
  • 举报
回复
to:oldmht(鸭子)
虽然修改了代码,但仍然有问题,像isCsPower这个东东,很可能就不是数字型。
过滤不全面。
yuliang0828 2005-11-26
  • 打赏
  • 举报
回复
setTimeout("opencolortext(" + id + "," + isCsPower + ")",3000);
oldmht 2005-11-26
  • 打赏
  • 举报
回复
那你先判断、过滤

id=request("id")
if not isnumeric(id) then id=0
isCsPower=request("isCsPower")
if not isnumeric(isCsPower) then isCsPower=0

rawjim 2005-11-26
  • 打赏
  • 举报
回复
楼上的代码有个缺陷,如果传过来的的id或者isCsPower为空字符的话,脚本将会出错。
oldmht 2005-11-26
  • 打赏
  • 举报
回复
setTimeout("opencolortext(<%=id%>,<%=isCsPower%>)",3000);
rawjim 2005-11-26
  • 打赏
  • 举报
回复
<%@LANGUAGE="VBSCRIPT"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<script>
function opencolortext(){
id="<%= request("id") %>";
isCsPower="<%= request("isCsPower") %>";
strURL="send_ZhuGuan2.asp?id="+id+"&isCsPower="+isCsPower;
window.open(strURL,"hello");
}
setTimeout("opencolortext()",3000);
</script>
</head>

<body>

</body>
</html>

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧