why Object required: 'history'?

hnalbert 2000-07-08 01:16:00
I have a piece of code as follows:

<script language="vbscript" runat="server">
sub goback()
history.back
end sub
</script>

<html><head><title>goback </title></head>
<body>
<%
call goback
%>
</body>
</html>

but when I submit to it, it doesn't work, and show the error message:

Microsoft VBScript runtime error '800a01a8'

Object required: 'history'

why?please help me?
...全文
75 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
Tyro 2000-07-08
  • 打赏
  • 举报
回复
如果这页是新打开的窗口,没有history呀!
zigzag 2000-07-08
  • 打赏
  • 举报
回复
很显然,history对象是客户端的,server上根本就没有这个对象或组件。
另外,服务器端脚本不能调用客户端脚本,应在客户端的事件中运行客户端过程。
可以由服务器脚本生成页面并处理事件。
如,要在网页装入时使页面回到上页。可以改为:

<script language="vbscript"> ‘客户端过程
sub goback()
history.back
end sub
</script>

<html><head><title>goback </title></head>
<%
response.write "<body onload=goback()>"
......
%>
</body>
</html>

此页面在进入时立即回到上页。

28,391

社区成员

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

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