• Toggling visibility of an object in JS
    2 replies, posted
I have a .swf that I am trying to hide and show using Javascript. These are my hiding / showing functions: [code]<script language="JavaScript"> function hideswf() { document.getElementById('swf').display = 'none'; document.getElementById('mask').display = ''; } function showswf() { document.getElementById('swf').display = ''; document.getElementById('mask').display = 'none'; } </script>[/code] The id of the div containing the .swf is definately "swf", and the div containing the link to the function has an id of "mask". The function definately calls because I put an alert in there to test. Why won't it work? You can see the whole page [url="http://www.robertandsherman.co.uk/view.php?postno=7"]here[/url].
[code]<script language="JavaScript"> function hideswf() { document.getElementById('swf').style.display = 'none'; document.getElementById('mask').style.display = ''; } function showswf() { document.getElementById('swf').style.display = ''; document.getElementById('mask').style.display = 'none'; } </script>[/code] There you go. [editline]01:11AM[/editline] Also, I'm not sure if [I]display = ''[/I] works.
Thanks, that was quite stupid :/
Sorry, you need to Log In to post a reply to this thread.