|
-
Feb 24th, 2003, 12:30 AM
#1
Thread Starter
Addicted Member
simple refresh
i have this code
Code:
<script language="JavaScript" type="text/JavaScript">
function RefreshMainWindow() {
window.opener.location.reload();
window.close()
}
</script>
//called by
<META HTTP-EQUIV="refresh" CONTENT="5; RefreshMainWindow();">
am i not allowed to call a method in a refresh block? how can i do something like this..
when the script runs, every 5 seconds, the parent refreshs, but the child windows (that this script is on) doesn't clse like it's supposed to, it refreshes too.. 
--770
-
Feb 24th, 2003, 06:33 AM
#2
Fanatic Member
when you open the window open it with a var name...
Code:
var newWin = window.open('page2.htm');
... the try doing newWin.close() instead.
-
Feb 24th, 2003, 07:52 AM
#3
Frenzied Member
Yes you can't use scripting in a meta refresh, I think you're looking for setTimeout():
Code:
<script type="text/javascript"><!--
window.setTimeout('RefreshMainWindow();', 5000);
//--></script>
Think that should work.
-
Feb 24th, 2003, 11:20 AM
#4
Thread Starter
Addicted Member
i'm new to JS, so not exactly sure where to put the script Rick Bull gave, and how to call it....
or how to give the opening window a variable name...
this is how i'm currently opening a new window
--770
-
Feb 25th, 2003, 07:18 AM
#5
Frenzied Member
You can put the code I gave either in the <head> section or the <body> section. I'd go with the head.
target="_blank" is find if you're just using standard links (which is better as not every browser supports JS). Other wise you can use javascript something like
Code:
var newWin = window.open('page.html', 'windowName');
Then you can use newWin with Javascript (e.g. newWin.close()) and target the new window with standard links like <a href="#" target="windowName">
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|