•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 397,835 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,516 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3584 | Replies: 3
![]() |
•
•
Join Date: Jul 2006
Posts: 3
Reputation:
Rep Power: 0
Solved Threads: 0
Hello DaniWeb members, I've just joined up and I would like to have one of my problems solved. I'm still a begginer at JavaScript coding so my request may seem a be easy for you guys to answer so here it is:
I have a JavaScript code and I want it to have a delay of 4 seconds before starting, the code is:
[html]<SCRIPT LANGUAGE="JavaScript">
var password = ''
password=prompt('Please enter your password:','');
if (password != null) {
location.href= password + ".html";
}
</SCRIPT>[/html]
I've searched through many sites and I havn't found an answer that'll help me, so i'm hoping that you guys will. :cheesy:
Thanks - Cronos
I have a JavaScript code and I want it to have a delay of 4 seconds before starting, the code is:
[html]<SCRIPT LANGUAGE="JavaScript">
var password = ''
password=prompt('Please enter your password:','');
if (password != null) {
location.href= password + ".html";
}
</SCRIPT>[/html]
I've searched through many sites and I havn't found an answer that'll help me, so i'm hoping that you guys will. :cheesy:
Thanks - Cronos
•
•
Join Date: Mar 2006
Posts: 29
Reputation:
Rep Power: 3
Solved Threads: 2
Put your script within a function and then use "setTimeout" to run the function:
TimeOut1=setTimeout("YourFunction()",4000);•
•
Join Date: Mar 2006
Posts: 29
Reputation:
Rep Power: 3
Solved Threads: 2
The name "password" might be a reserved word, so I changed it to "pword" to avoid trouble:
<script type="text/javascript">
function Password() {
var password = ''
pword=prompt('Please enter your password:','');
if (pword == '') {
alert('The password was null.');
} else {
location.href= pword + ".html";
}
}
TimeOut1=setTimeout("Password()",4000);
</script>![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
- Delay JavaScript execution (JavaScript / DHTML / AJAX)
- JavaScript execution delay (JavaScript / DHTML / AJAX)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Ajax instant chat example to download with source code
- Next Thread: How to correct this javascript UNDER Mozilla Firefox?


Linear Mode