Zaithe Posted April 1, 2006 Share Posted April 1, 2006 So, after completely learning HTML, now I want to learn Javascript. Ive nearly learnt all of it, all I need to learn now is to make more then 1 alert box appear at once. This is what ive got to make one alert box appear then after clicking ok another one comes up :<html><head><script type="text/javascript">{alert("ORLY?")}{alert ("YARLY!")}</script></head></html>But that only makes one come up then they click "Ok" THEN the other one comes up. I want to make them all to come up at once so it gets really annoying. The reason I want to make this is because I want to make a the website called "The Attack Of The Killer Pop-Ups". So, all I need is a script to make loads come up at once then they click "Close" but then loads more come up. So please tell me how to do this.Many Thanks. Link to comment Share on other sites More sharing options...
scott100 Posted April 1, 2006 Share Posted April 1, 2006 You can only have one alert() pop up at one time, if you try with more than one they just appear one after the next.I wouldn't advise floading the visitor with pop-ups, as you've said they are annoying and more than one is surely enough to drive the visitor away, for good! Link to comment Share on other sites More sharing options...
Zaithe Posted April 1, 2006 Author Share Posted April 1, 2006 Probaly because your computer was lagging so you pressed submit twice.Well, ive seen other sites do this but oh well. Link to comment Share on other sites More sharing options...
scott100 Posted April 1, 2006 Share Posted April 1, 2006 Well, ive seen other sites do this but oh well.<{POST_SNAPBACK}> You are probably thinking of pictures, they give the appearance of alert boxes but are realy just floating pics or divs.Are you talking about the ones that say "alert, you computer may have a virus, click here....." and there's like 3 or so on the same page? Link to comment Share on other sites More sharing options...
Zaithe Posted April 1, 2006 Author Share Posted April 1, 2006 They are ads on the page arent they? Basically, I want loads of pop-ups to come up. I wouldn't advise floading the visitor with pop-ups, as you've said they are annoying and more than one is surely enough to drive the visitor away, for good!Thats why the website is called "Attack Of The Killer Pop-Ups!", the point of the website is that you have to get through all the pop-ups to complete the game... Link to comment Share on other sites More sharing options...
scott100 Posted April 1, 2006 Share Posted April 1, 2006 Are you looking for something like this: <head><script>function getEm(){ document.getElementById(1).style.display="none"; document.getElementById(2).style.display="block";}</script></head><body><div id="1" style="display:block"><img style="position:absolute;top:10px;left:400px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /><img style="position:absolute;top:150px;left:150px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /><img style="position:absolute;top:250px;left:500px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /><img style="position:absolute;top:0px;left:700px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /><img style="position:absolute;top:400px;left:120px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /><img style="position:absolute;top:450px;left:450px;" src="http://img160.imageshack.us/img160/6282/pop12en.jpg" /></div><div id="2" style="display:none"><img style="position:absolute;top:15px;left:600px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /><img style="position:absolute;top:230px;left:20px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /><img style="position:absolute;top:350px;left:400px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /><img style="position:absolute;top:250px;left:700px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /><img style="position:absolute;top:100px;left:250px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /><img style="position:absolute;top:450px;left:0px;" src="http://img90.imageshack.us/img90/6789/pop22ao.jpg" /></div><br /><br /><br /><br /><br /><br /><input type="button" value="bugger off" onclick="getEm()" /></body> Link to comment Share on other sites More sharing options...
Zaithe Posted April 1, 2006 Author Share Posted April 1, 2006 Kind off, but I want them being real pop-ups. Link to comment Share on other sites More sharing options...
scott100 Posted April 2, 2006 Share Posted April 2, 2006 Afraid not then, as i said before you can only have one real alert on the screen at any time. Link to comment Share on other sites More sharing options...
Jonas Posted April 2, 2006 Share Posted April 2, 2006 Afraid not then, as i said before you can only have one real alert on the screen at any time.<{POST_SNAPBACK}> Unless you use window.open()... Link to comment Share on other sites More sharing options...
Zaithe Posted April 3, 2006 Author Share Posted April 3, 2006 Unless you use window.open()...<{POST_SNAPBACK}> How do I use window.open() Im still a n00b to Javascript. Link to comment Share on other sites More sharing options...
Little Goat Posted April 3, 2006 Share Posted April 3, 2006 here's an example: <html><head><title>attack of the killer popups</title><script type="text/javascript">function popup(amount){for(i=1 i<=amount i++){window.open("url of your file",status=no,toolbar=no,location=no,menubar=no,width=400,height=200)}}</script></head><body><input type="button" value="start" onmousedown="popup(anynumberhere)"/></body></html> and the code of the opened pages <html><head><title>attack of the killer popups</title><script type="text/javascript">function popup(amount){for(i=1 i<number i++){window.open("url of your file",status=no,toolbar=no,location=no,menubar=no,width=400,height=200)}window.close()}</script></head><body><input type="button" value="OK" onmousedown="popup(anynumberhere)"/></body></html> anyone correct me if i'm wrong, i'm new :)you can also use the math.random to make a random number of popups too, I think.well, I just tried it and it doesn't work for me, maybe someone can fix it for you.:)LG Link to comment Share on other sites More sharing options...
Jonas Posted April 4, 2006 Share Posted April 4, 2006 When declaring i, you need to separate the conditions with a semicolon;for (i=1;i<=amount;i++) {} 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