...

View Full Version : showing div w/ delay



namitsu
05-17-2009, 02:28 PM
Hi there. I'm trying to get a DIV object to show like 2 seconds after the page loads. I tried something like this but it's not working:



<script>
function showDiv(id){
var obj = document.getElementById(id);
obj.style.display = 'block';
}
</script>

</head>

<body onLoad="setTimeout('showDiv(content)', 3000);">

<div id=content style="display: none;">
MY CONTENT
</div>

nullpointer
05-17-2009, 02:53 PM
the code below works. be careful with how you use quotes



<script>
function showDiv(){
var obj = document.getElementById('content');
obj.style.display = 'block';
}
</script>

</head>

<body onLoad="setTimeout('showDiv()', 1000);">

<div id='content' style="display: none;">
MY CONTENT
</div>

namitsu
05-17-2009, 10:35 PM
THanks worked.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum