Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Javascript 

Link other script in script. | &[b]#34[/b];hide&[b]#34[/b]; script from running

Hey!

I have my little project. i want a window to last 6 seconds, then it should run another script and close itself.
I am pretty new to JavaScript but i am willing to learn.
Here´s my code:

Code
    function timedOutStart(){
        setTimeout(timedOutStart(), 6000);
        document.getElementById("runfile")
        window.close();
    }

Code
<script id="runfile" type="text/VBScript">
CreateObject("WScript.Shell").Run "test.bat"
</script>

This is the HTML code i am using to execute the script:

Code
<body [b]onload=[/b]"timedOutStart()">

In addition to the first thing i want to realize, i want to stop the VBScript from running onload. It just executes the Batch file at start, but i want it to start the Batch file after those 6 seconds of the first script.

I hope you can help me.

-L-
I don't quite get what you're doing... You're calling timedOutStart() after six seconds, which calls timedOutStart() after six seconds, which calls timedOutStart() after six seconds... it will never run. You want the VBScript to run after six seconds, then close the window?

PHP Code

<?php 
window
.onload = function()
{
    
window.setTimeout(function() {
        
document.getElementById('runfile');
        
window.close();
    }, 
6000);
} 

In JavaScript, your getElementById method would not work to run the script. Is VBScript different? If not, it still won't work. You need to put your VBScript in a function and call it.

Lastly, never use HTML's onload/onclick/etc. Mixing your JS into your HTML is bad practice.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Javascript]  by exploit.cSep 27, 2015 07:30 PM 1 310 Sep 27, 2015 07:30 PM
Last Post: 300FGE
[PHP] by chris0147Dec 22, 2011 12:52 PM 0 124 Dec 22, 2011 12:52 PM
Last Post: chris0147
[PHP] by Jordan..Aug 18, 2011 01:27 PM 4 91 Aug 18, 2011 01:27 PM
Last Post: Dreamt