applecoder Posted March 23, 2007 Share Posted March 23, 2007 I do not want to open a new window with a link, a button, or some other event, that is readily available. nor do I want to close a window with a timer.I want to wait say 5 seconds and have a script open a new window with a predefined size and so forth, I got the predefined size and window location with a link activation script, but I do not want the viewer to have to click anything after seeing the splash page, and the REFRESH command is limited.Is there a script that can do this? I have tried tweaking others, but I am not the pro js coder that I would like to be.I have been looking for over a week and have spent hours at a time searching and testing.EXAMPLEuser goes to a url, the page loads the logo and in 5 seconds a new window is opened at a specified size and location, now the user can navigate the site.am I missing something? this can be done?AC Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 23, 2007 Share Posted March 23, 2007 function popitup(url) { newwindow=window.open(url,'name','height=200,width=150'); if (window.focus) {newwindow.focus()} return false;}onload = l();function l(){timer = setTimeout("popitup('http://w3schools.com')",5000);} I think this will work! Link to comment Share on other sites More sharing options...
iyeru42 Posted March 23, 2007 Share Posted March 23, 2007 onLoad needs an attachEvent added to it. Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 23, 2007 Share Posted March 23, 2007 I ve wirrten onload= l(); Link to comment Share on other sites More sharing options...
aspnetguy Posted March 23, 2007 Share Posted March 23, 2007 onLoad needs an attachEvent added to it.onload is the event. Writing onload = function is the same as window.onload = function or document.body.onload = function, etcBTW changeonload = l();to onload = function(){l()}oronload = l; Link to comment Share on other sites More sharing options...
iyeru42 Posted March 23, 2007 Share Posted March 23, 2007 onload is the event. Writing onload = function is the same as window.onload = function or document.body.onload = function, etcBTW changeonload = l();to onload = function(){l()}oronload = l;Woo, now I no longer need to use attachEvent for that. Thanks a bunch. Link to comment Share on other sites More sharing options...
aspnetguy Posted March 23, 2007 Share Posted March 23, 2007 you can use element.event for pretty much everything or write a common addEvent function that is cross browser. using addEventListener (w3c) and attachEvent (IE) is considered the best way of doing it but element.event works in all browsers and is perfect for me whenI want to be lazy Link to comment Share on other sites More sharing options...
PrateekSaxena Posted March 24, 2007 Share Posted March 24, 2007 sorry for writing l(); I forgot .I wrote it straight in the FastReply, did not test it...sorry Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now