急救!求进入一网页后自动刷新一次的方法

net86 2008-04-12 11:33:13
急救!求进入一网页后自动刷新一次的方法
(注,只刷新一次,不是连续刷新的)
...全文
342 20 打赏 收藏 转发到动态 举报
写回复
用AI写文章
20 条回复
切换为时间正序
请发表友善的回复…
发表回复
jacky_q 2008-04-13
  • 打赏
  • 举报
回复
14楼的不大对.试试这样的.
<code>
if(window.location.href.indexOf("refreshed") < 0){
window.location+="&refreshed";
}
</code>

net86 2008-04-12
  • 打赏
  • 举报
回复
还有refresh是哪里来的?不明白请教一下大虾
net86 2008-04-12
  • 打赏
  • 举报
回复
还有,网站进入后到index.asp页呢,还是到index.asp?refresh=true页....
不太明白
net86 2008-04-12
  • 打赏
  • 举报
回复
其它的页面都加怎么办呢?
net86 2008-04-12
  • 打赏
  • 举报
回复
我找了一个比较好的,奉献给大家了:


<Script>
function reurl(){

url = location.href; //把当前页面的地址赋给变量 url

var times = url.split("?"); //分切变量 url 分隔符号为 "?"

if(times[1] != 1){ //如果?后的值不等于1表示没有刷新

url += "?1"; //把变量 url 的值加入 ?1

self.location.replace(url); //刷新页面

}
}

onload=reurl

</script>


原理

充分利用地址栏可带参数的选项,用脚本来取得页面间的传递参数,并不需要后台程序的支持。

2008-04-12
  • 打赏
  • 举报
回复
第一次加载传个参数,
加载后检测,如果有参数,就重新加载并去掉参数
例:asp的
index.asp?refresh=true

if request.querystring("refresh") = "true" then
response.redirect("index.asp")
end if
net86 2008-04-12
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 yeqiufeng 的回复:]
这是javascript版。

用js当然能轻松搞定。

下面给出伪代码,因为我不曾调试。

if(window.location.search.indexOf("refreshed") <0) //说明没被刷新过
{
window.location=window.location+"&refreshed";//我不知道你的URL是怎么样的,加?还是加&,自己判断吧。
}


原理就是这样。修行看个人啦。

@_@
[/Quote]

我的URL是这样的:
http://www.bulux.cn/products.asp?id=410
请教一下,进入这个页面后,怎么才能立即刷新一次呢???
net86 2008-04-12
  • 打赏
  • 举报
回复
[Quote=引用 14 楼 yeqiufeng 的回复:]
这是javascript版。

用js当然能轻松搞定。

下面给出伪代码,因为我不曾调试。

if(window.location.search.indexOf("refreshed") <0) //说明没被刷新过
{
window.location=window.location+"&refreshed";//我不知道你的URL是怎么样的,加?还是加&,自己判断吧。
}


原理就是这样。修行看个人啦。

@_@
[/Quote]

俺没搞定....5555
jikun6666 2008-04-12
  • 打赏
  • 举报
回复
可不可以像这样

if(!ispostpage)
{
reponse.Redirect("index.asp")
}

可不可以问一下,这样有什么意义啊?
net86 2008-04-12
  • 打赏
  • 举报
回复
[Quote=引用 12 楼 chinmo 的回复:]
汗!!!!!!!!!
无语了
难道不懂request这个对象?
[/Quote]
request对象俺知道,这里面request("refrash")的"refrash"是哪里来的?搞不懂..
「已注销」 2008-04-12
  • 打赏
  • 举报
回复
这是javascript版。

用js当然能轻松搞定。

下面给出伪代码,因为我不曾调试。

if(window.location.search.indexOf("refreshed")<0) //说明没被刷新过
{
window.location=window.location+"&refreshed";//我不知道你的URL是怎么样的,加?还是加&,自己判断吧。
}


原理就是这样。修行看个人啦。

@_@
shouzheng 2008-04-12
  • 打赏
  • 举报
回复
这么沟通挺困难的 楼上好几位的办法都能达到效果
  • 打赏
  • 举报
回复
汗!!!!!!!!!
无语了
难道不懂request这个对象?
net86 2008-04-12
  • 打赏
  • 举报
回复
还是不懂...request("refrash")是从哪里来的?
5555
  • 打赏
  • 举报
回复
index.asp?refrash=true

比如在页面顶部加<%if request("refrash")<>true then
response.redirect "index.asp?refrash=true"
end if%>
  • 打赏
  • 举报
回复
不要加载参数了,你加载参数就是要做一次跳转动作
net86 2008-04-12
  • 打赏
  • 举报
回复
还有,怎么第一次加载传个参数?
俺是菜鸟,请大虾们说明白点.先谢了
  • 打赏
  • 举报
回复
使用cookie或者session,为空时就自动刷新,不为空了就不刷新了
net86 2008-04-12
  • 打赏
  • 举报
回复
还是不太明白...55555
Hntxh 2008-04-12
  • 打赏
  • 举报
回复
先进到index.asp页面,让后在传递一个参数转到index.asp?refrash=true

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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