如何在重新加载页面时判断? [英] how can I tell when a page is done reloading?
问题描述
我想在浏览器窗口中重新加载网址,所以我这样做:
open(window.location.href =" www.yahoo.com");
ok,所以现在我想在页面完成后做点什么装完
完全。我该怎么做?
我试过的是:
a = open(window.location.href =" www.yahoo.com");
a.onload = b();
函数b(){
alert(" Done !!");
}
但这都不起作用。我只关心IE。
关于如何让它工作的任何建议?
我的目标,如果从上面不清楚,是加载一些任意页面一个
的窗口,然后执行<其他>,功能b(),只有当那个页面
完全加载时才会加载。
在IE中,使用正文中的onreadystatechange事件处理程序:
< body onreadystatechange =" if(this.readyState ==''loaded''){....}">然而,
onload =的工作方式相同。
Danny
-
使用Opera的革命性电子邮件客户端: http://www.opera.com/mail/
不,你不明白。我无法控制
子窗口的内容。如果我这样做,我会使用onload或者你已经建议的任何
。
如何判断子窗口何时完成加载?当我没有
控制儿童窗口的内容时。
" jaialaitech nology"写了确定,所以现在我想在页面完成加载完成后做点什么。我该怎么做?
我试过的是:
a = open(window.location.href =" www.yahoo.com");
两个错误:window.open()方法有三个参数,都是可选的,
所有字符串,但你有一个脚本语句。第一个参数是
要打开的url,相对于当前页面,还是绝对的,其中
情况下协议,通常是http :,是必需的;第二个和第三个指定
名称和功能,如条形和大小。
您在此处作为参数传递的内容,是Javascript的返回值
语句window.location.href =等。这恰好是
包含url的字符串,但协议缺失所以它被解释为
相对。
你在看什么for是这样的:
window.open(" http://www.yahoo.com");
a.onload = b();
一:在为事件处理程序分配函数时,你不一定想要执行该函数
。放下方括号(),你就没事了。
但是:这将永远不会跨域工作。浏览器内置安全性
措施可防止JavaScript访问不是来自同一个
域的网页。只有当您打开一个包含您自己网站页面的窗口时,您才能支持
附加onload事件处理程序和其他内容。有关这方面的更多信息,请尝试
< http://www.google.com/search?q=相同+来源+政策>
hth
ivo
http://www.ariel.shakespearians.com/
I want to reload a url in a browser window so I do something like this:
open(window.location.href= "www.yahoo.com");
ok, so now I want to do something when that page is done loading
completely. how do I do this?
What I have tried is this:
a=open(window.location.href= "www.yahoo.com");
a.onload=b();
function b(){
alert("Done!!");
}
but none of this works. I am only concerned with IE.
Any advice on how I can get this to work?
My goal, if not clear from above, is to load some arbitrary page in a
window and then do <something else>, function b(), only when that page
is completely done loading.
In IE, use the onreadystatechange event handler in the Body:
<body onreadystatechange="if(this.readyState==''loaded''){ ....}"> however,
onload= works the same way.
Danny
--
Using Opera''s revolutionary e-mail client: http://www.opera.com/mail/
No, you didn''t understand. I have no control over the content of the
child window. If I did I would have used onload or whatever you
suggested already.
How do I tell when a child window is done loading? WHEN I HAVE NO
CONTROL OVER THE CONTENT OF THE CHILD WINDOW.
"jaialaitech nology" wroteok, so now I want to do something when that page is done loading
completely. how do I do this?
What I have tried is this:
a=open(window.location.href= "www.yahoo.com");
Two mistakes: the window.open() method takes three parameters, all optional,
all strings, but you have a script statement there. The first parameter is
the url to open, either relative to the current page, or absolute, in which
case the protocol, usually http:,is required; the second and third specify
the name and features such as bars and sizes.
What you pass as the parameter here, is the returnvalue of the Javascript
statement window.location.href=etc. This happens to be the string that
contains the url, but the protocol is missing so it is interpreted
relatively.
What you are looking for is something like this:
window.open( "http://www.yahoo.com" );
a.onload=b();
One: When assigning a function to an event handler, you don''t necessarily
want to execute that function. Drop the brackets () and you ''re fine.
However: this will never work cross-domain. Browser built-in security
measures prevent JavaScript from accessing pages that are not from the same
domain. Only when you open a window with a page from your own site, can you
attach onload event handlers and other stuff. For more on this, try
< http://www.google.com/search?q=same+origin+policy >
hth
ivo
http://www.ariel.shakespearians.com/
这篇关于如何在重新加载页面时判断?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!