Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

POP UP WINDOW ON PAGE LOAD

Status
Not open for further replies.

fishin4snook

IS-IT--Management
Sep 20, 2000
83
US
How do you get a window to pop up on page load?
[sig][/sig]
 
Hi fishin4snook,

Just need to add an onload event inside the <body> tag and call your open window function.

for example:
<script>
function openwin() {
newWin=window.open(......)
}
</script>
<body onload=&quot;openwin()&quot;>


hope this helps [sig]<p>Chiu Chan<br><a href=mailto:cchan@gefmus.com>cchan@gefmus.com</a><br><a href= America, Inc</a><br>[/sig]
 
It gives me an internet explorer javascript error when pasting

<script>
function openwin() {
newWin=window.open(......)
}
</script>

Into the head code. and pasting

onload=&quot;openwin()&quot;

Into the body of the html.


[sig][/sig]
 
hi fishin4snook,

try this again.
<html>
<head>
<script>
function openwin() {
newWin=window.open()
}
</script>
<body onload=&quot;openwin()&quot;>
</body>
</html>


[sig]<p>Chiu Chan<br><a href=mailto:cchan@gefmus.com>cchan@gefmus.com</a><br><a href= America, Inc</a><br>[/sig]
 
Thanks for the tip, I was putting the script inside of the Head of the html and not after it.

Do you know how to make that window close after a certain number of seconds?

Thank you again.
Fishin4snook. [sig][/sig]
 
Fishin4snook,

try this the closewin function will get call after 5 seconds,

<html>
<head>
<script>
var delay=5000;
function openwin() {
newWin=window.open()
setTimeout(&quot;closewin()&quot;, delay);
}

function closewin() {
newWin.close();
}
</script>
<head>
<body onload=&quot;openwin()&quot;>
</body>
</html>
[sig]<p>Chiu Chan<br><a href=mailto:cchan@gefmus.com>cchan@gefmus.com</a><br><a href= America, Inc</a><br>[/sig]
 
Thank you for all of your advice on this subject. One question though how do you define which window you want to pop up?

Thank you,
Fishin4snook. [sig][/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top