/* Get rid of the onclick, the timer is what is showing the item, not the click */
<a onclick ="javascript:ShowHide('HiddenDiv')" href="javascript:;" >Show/Hide</a>
/* add to your body tag the timer so when the page is done loading it calls up the text */
<body onload="TimerSet();">
<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
This text was hidden
</div>
<script language="JavaScript">
/* set a global var so we can clear out timer */
var otime;
/* add this to the script since you don't want the timer set in the function that does whatever the timer is supposed to do */
function TimerSet(){
otime = setInterval(ShowHide(divId),10000);
}
/* Notice the change, where the timer wasn't in the function at all, and is not there anymore */
function ShowHide(divId){
if(document.getElementById(divId).style.display == 'none')
{
document.getElementById(divId).style.display='block';
}
else
{
document.getElementById(divId).style.display = 'none';
}
/*clear out the timer to we don't have it run */
clearTimeout(otime);
}
</script>
/* Get rid of the onclick, the timer is what is showing the item, not the click */
<a onclick ="javascript:ShowHide('HiddenDiv')" href="javascript:;" >Show/Hide</a>
/* add to your body tag the timer so when the page is done loading it calls up the text */
<body onload="TimerSet();">
<div class="mid" id="HiddenDiv" style="DISPLAY: none" >
This text was hidden
</div>
<script language="JavaScript">
/* set a global var so we can clear out timer */
var otime;
/* add this to the script since you don't want the timer set in the function that does whatever the timer is supposed to do */
function TimerSet(){
otime = setInterval(ShowHide(divId),10000);
}
/* Notice the change, where the timer wasn't in the function at all, and is not there anymore */
function ShowHide(divId){
if(document.getElementById(divId).style.display == 'none')
{
document.getElementById(divId).style.display='block';
}
else
{
document.getElementById(divId).style.display = 'none';
}
/*clear out the timer to we don't have it run */
clearTimeout(otime);
}
</script>
I dont want to get rid of the onlick since the hidden text will show up only if someone clicks the link.
when he clicks the link I want to wait 10 seconds before the hidden text appears
Bookmarks