|
|
|
|
|
|
|
|
|
Thread tools
Search this thread
Display Modes
|
|
04-01-2006, 11:36 PM
|
#1
|
Status: Waving
Join date: Aug 2005
Location:
Expertise:
Software:
Posts: 2,694
|
Javascript
I know how to make a getElementById(); but is it possible to maby use something like:
function delayPage(){
delay code for x seconds, with diplayed image
then loads another funtion for the div visibility?
So what im asking is, I need code to delay time with a image.
}
Thanks!
|
|
04-01-2006, 11:48 PM
|
#2
|
Status: Custom User Title
Join date: Apr 2005
Location:
Expertise:
Software:
Posts: 2,297
|
I don't think you can use something like delayPage() to delay the code loading. Infact, I don't think you can actually delay the parsing of code to the browser using Javascript.
|
|
04-02-2006, 12:40 AM
|
#3
|
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
Posts: 335
|
|
|
04-02-2006, 09:02 AM
|
#4
|
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
Posts: 3,820
|
Jonny gets the gold star! You can set an event to happen in the future using the setTimeout (or repeatedly, with setInterval) function.
Code:
// Alerts 'Hello World' after two seconds
window.setTimeout("alert('Hello World')", 2000)
|
|
04-03-2006, 06:53 PM
|
#5
|
Status: Waving
Join date: Aug 2005
Location:
Expertise:
Software:
Posts: 2,694
|
But could I do this to say like:
function delayPage(divName, delayTime){
window.setTimeout("document.getElementById(divName ).style.display = "block";", delayTime)
}
|
|
04-03-2006, 10:06 PM
|
#6
|
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
Posts: 335
|
Sure, try this:
HTML Code:
function delayPage(divName, delayTime){
window.setTimeout(
function() {
document.getElementById(divName).style.display = "block"
}
, delayTime)
}
|
|
04-03-2006, 11:35 PM
|
#7
|
Status: Waving
Join date: Aug 2005
Location:
Expertise:
Software:
Posts: 2,694
|
If I may ask, what does the function() do? Why cant you leave the document.getElementById(divName).style.display = "block"?
|
|
04-04-2006, 10:38 PM
|
#8
|
Status: I love this place
Join date: Jan 2005
Location: The Netherlands
Expertise: Frontend, vBulletin
Software: Coda, Photoshop
Posts: 607
|
Originally Posted by Garrett
Why cant you leave the document.getElementById(divName).style.display = "block"?
|
That's the code that makes the part you selected, visible.
|
|
04-05-2006, 02:22 AM
|
#9
|
Status: Waving
Join date: Aug 2005
Location:
Expertise:
Software:
Posts: 2,694
|
But I didnt get why he used a function(){}
|
|
04-05-2006, 05:42 PM
|
#10
|
Status: Member
Join date: Feb 2005
Location: UK
Expertise:
Software:
Posts: 335
|
Because it asks for a function in the specification obviously.
|
|
|
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
|