请问各位大侠怎样把同一页上JavaScript的变量值传给ASP变量

kookies 2003-06-11 03:33:07
<script>
……
document.write(string1);
</script>

<%
dim temp
temp=string1
response.Write(temp)
……
%>
这样是实现不了的,请问有什么办法?
...全文
33 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
gamehero 2003-06-12
  • 打赏
  • 举报
回复
这样可以实现将JS变量传递给VBS,可不可以反过来呢?

VBS-->JS?
kookies 2003-06-12
  • 打赏
  • 举报
回复
厉害!thx 粽子
CHARGING 2003-06-12
  • 打赏
  • 举报
回复
<%
dim temp
temp=request("poststr")
%>
<html>
<head>
<title>test</title>
</head>
<body><script language="javascript">
var string1;
string1="hello";
//document.write(string1);
<%if temp="" then%>window.location.href = "test.asp?poststr=" + string1;<%end if%>
</script>

<%
response.Write(temp)
%>
</body>
</html>
CHARGING 2003-06-12
  • 打赏
  • 举报
回复
死循环了,你每次进入页面是都重定位到:"test.asp?poststr=" + string1,当然不行了。
kookies 2003-06-12
  • 打赏
  • 举报
回复
我做了一个 test.asp 页
代码如下

<html>
<head>
<title>test</title>
</head>
<body><script language="javascript">
var string1;
string1="hello";
//document.write(string1);
window.location.href = "test.asp?poststr=" + string1;
</script>

<%
dim temp
temp=request("poststr")
response.Write(temp)
%>
</body>
</html>

请问cooly为什么“response.Write(temp)”不能实现,而且该页还在不停的闪?
Cooly 2003-06-11
  • 打赏
  • 举报
回复
<script>
……
document.write(string1);
window.location.href = "thispage.asp?poststr=" + string1;
</script>

<%
dim temp
temp=request("poststr")
response.Write(temp)
……
%>
tangbow 2003-06-11
  • 打赏
  • 举报
回复
好像如sinzy(ASP.NETer...) 所说
sinzy 2003-06-11
  • 打赏
  • 举报
回复
没有办法,ASP代码先于一切HTML内容执行。

28,391

社区成员

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

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