...

View Full Version : FOR LOOP problem in JavaScript! HELP!



angelali
12-18-2011, 02:35 PM
What I am trying to do is when a user click on an image button, 10 new windows will oppen. So, I created a For Loop function for that. Here is my code below:

function clickk () {
for (i=0; i<=10, i++) {
window.open('annoying1.html','Annoying LOL','width=900, height=900')
;}
}

However, the window does open but not 10 times. Can you help me? Thank you... :(

Philip M
12-18-2011, 02:37 PM
You are opening the same window 10 times. :eek:

You must give each one a different name.

All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

angelali
12-18-2011, 02:55 PM
When I do only:

window.open('annoying1.html');

it is working, but I do not want the menu bar to appear, and when i do tht, it is not working. only when it is having the URL like above, it is working.

Logic Ali
12-18-2011, 03:31 PM
Another problem is that IE won't allow a space in a window name.
If your browser allows opening multiple windows from one commend, this may work:

function clickk ()
{
for ( var i=1; i<=10, i++ )
window.open('annoying1.html', 'Annoying_LOL('+i+')', 'width=900, height=900');
}

Old Pedant
12-19-2011, 08:37 AM
I don't think IE will allow ( ) in window names, either. But I don't see why those need to be there, at all.

Why not simply:


function clickk ()
{
for ( var i=1; i<=10, i++ )
window.open('annoying1.html', 'Annoying_LOL'+i, 'width=900, height=900');
}

angelali
12-19-2011, 10:13 AM
Guys I got the answer... here it is:

var openWind = new Array();
function clickk () {
for (i=1; i<=15; i++) {
openWind[i] = window.open('annoying.html','window'+i,'menubar=no')
;}
}

thank you :)

Philip M
12-19-2011, 11:02 AM
I expect that you realise that sort of thing will guarantee that people will visit your site once only. :rolleyes:

angelali
12-19-2011, 08:18 PM
lol lol lol

Old Pedant
12-20-2011, 01:34 AM
Well, actually, it might guarantee that an annoyed hacker will set up a robot to hit his site millions of times per day and cause his server to crash. So if he is on a shared host, you can bet his host will kick him off right after that happens the first time.

angelali
12-20-2011, 05:11 AM
I am making the most annoying website in the world... it is for fun... It has already finished...if you want visit it...but do read the conditions before pressing Enter.. :D I will give you the link now...the website's name is Most Annoying Website. So what hacker are you talking when everyone knows it is for annoying people and for fun? I will not care my server, will the hacker hack popular paid hosting like Bluehost, dreamhost and so on when he knows the website is for fun and based only to annoy people? Know what you are talking man! It is not a normal website like others... on Most Annoying Website, you get pawned and it is for fun.. you take the risk to click on the Enter button...and I will not care if people do not read the conditions! ;) :p :) :D :thumbsup:

Philip M
12-20-2011, 09:12 AM
I am making the most annoying website in the world... it is for fun... It has already finished

Have you visited your doctor recently? Your idea of fun is a bit strange, especially as you can only snigger at the general thought of annoying your (unknown) visitors. People who massively enjoy annoying others are in need of help. Another suggestion is to grow up. :rolleyes:

http://emedicine.medscape.com/article/918095-overview

angelali
12-20-2011, 09:15 AM
Do you know websites like Red Dot, takethisllolipop and so on? Why you dont say they are retards? If you dont agree with my idea...don't say it is retard! :mad:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum