Popup
Posted: Sat Sep 06, 2008 4:24 pm
Hello,
I've stumbled upon 2 Javascript issues when making a small pop-up function. The pop-up is just like the one Newgrounds has; the background get's darkened and the content is in a div.
Now I couldn't figure out how to center (vertical and horizontal) the div with content. The div can't be centered by using margin, since it's position is absolute. I guess this would need to be done with Javascript.
The second problem is that setTimeout in Internet Explorer doesn't work like the rest of the browsers, you can't pass arguments to functions you call.. I've searched around a little bit and haven't found a solution. The problem is that I use a for-loop
This doesn't work in IE, because I need to pass argument i to the function show_popup. I have tried several other methods but failed.
Thanks in advance
I've stumbled upon 2 Javascript issues when making a small pop-up function. The pop-up is just like the one Newgrounds has; the background get's darkened and the content is in a div.
Now I couldn't figure out how to center (vertical and horizontal) the div with content. The div can't be centered by using margin, since it's position is absolute. I guess this would need to be done with Javascript.
The second problem is that setTimeout in Internet Explorer doesn't work like the rest of the browsers, you can't pass arguments to functions you call.. I've searched around a little bit and haven't found a solution. The problem is that I use a for-loop
Code: Select all
for (i=1; i<=100; i++) {
setTimeout(show_popup,i*4,i);
}Thanks in advance