Forum Moderators: open

Message Too Old, No Replies

show/hide div in Safari

How can I get this to work in Safari

         

jrthor2

5:42 pm on Apr 12, 2005 (gmt 0)

10+ Year Member



I have the following script to hide a particular dive on my page, and show a please wait animated gif when a button is clicked. This works fine in IE6,Firefox,Opera, but in Safari, it gets hung on the please wait and will not go to the next page. This is being used on a java page, where I am submitting form information to a backend bean and then waiting for a response.

<script>
function gowait() {
if (document.getElementById) { document.getElementById("formDiv").style.display="none";
document.getElementById("pleaseWaitDiv").style.display="block";
} else if (document.all) {
document.all["formDiv"].style.display="none";
document.all["pleaseWaitDiv"].style.display="block";
} else if (document.layers) {
document.layers["formDiv"].style.display="none";
document.layers["pleaseWaitDiv"].style.display="block";
}
}
</script>

dcrombie

3:22 pm on Apr 13, 2005 (gmt 0)



I use something like this which you should be able to adapt:

if(child.currentStyle) { 
// applies to msie only
child.style.display = "block";
} else {
child.style.setProperty("display", "block", "");
}

document.layers is only for Netscape.

jrthor2

4:00 pm on Apr 13, 2005 (gmt 0)

10+ Year Member



How could I make this work in my code? I am a javascript newbie.