Forum Moderators: open
My not working attempt...
function hidebodyDiv(divID_as_a_string) {
setTimeout("hideDiv(divID_as_a_string)",100);); {
var myReference = getRefToDiv(divID_as_a_string);
if(!myReference ) { window.alert('Nothing works in this browser'); return; }
if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
window.alert('Nothing works in this browser'); return; } }
}
}
JavaScript - Hide Function
function hideDiv(divID_as_a_string) {
var myReference = getRefToDiv(divID_as_a_string);
if(!myReference ) { window.alert('Nothing works in this browser'); return; }
if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
window.alert('Nothing works in this browser'); return; } }
}
HTML - Event
<element onEVENT="hideDiv('elementIDb1');
- John
function hideTimedDiv(divID_as_a_string) {
setTimeout ("hideTimedDiv('" + divID_as_a_string + "',3000);"); {
var myReference = getRefToDiv(divID_as_a_string);
if(!myReference ) { window.alert('Nothing works in this browser'); return; }
if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
window.alert('Nothing works in this browser'); return; } }
}
}
Try something like below to narrow the problem, extra code for debug only.
Where you getting any alerts?
function hideTimedDiv(divID_as_a_string) {
setTimeout ("hideTimedDiv('" + divID_as_a_string + "',3000);"); {
var myReference = getRefToDiv(divID_as_a_string);
alert( divID_as_a_string + " myReference " + ( myReference!= null ) );
if(!myReference ) { window.alert('Nothing works in this browser Case1'); return; }
if( myReference.style ) { myReference.style.visibility = 'hidden'; } else {
if( myReference.visibility ) { myReference.visibility = 'hide'; } else {
window.alert('Nothing works in this browser'); return; } }
}
}
What is code intended to do, seems to hide the div each time, is something else unhidding it or is the intent to toggle the visibility?