[Ma-linux] javascript - toggle image visibility
Igor Birman
igor_birman at yahoo.com
Wed Oct 21 14:41:37 EDT 2009
Steve,
This should work:
<BUTTON TYPE="button"
onClick="document.getElementById('toggleImage').style.display = 'block';">show image</BUTTON>
<BUTTON TYPE="button"
onClick="document.getElementById('toggleImage').display = 'none';">hide image</BUTTON>
<image id="toggleImage"
src=".\thePicture.bmp">
But once you start down this road you should investigate using a javascript library - they have easier and more consistent/more browser independent ways of doing these things. We currently like jQuery:
http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
Igor
________________________________
From: "Johnson, Steve (NIH/OD/ORS) [E]" <johnsons at vrp.ncrr.nih.gov>
To: "ma-linux at calypso2.tux.org" <ma-linux at calypso2.tux.org>
Sent: Wed, October 21, 2009 2:27:26 PM
Subject: Re: [Ma-linux] javascript - toggle image visibility
Please help me with this code (javascript)
<BUTTON TYPE="button"
onClick="toggleImage.display = block;">show image</BUTTON>
<BUTTON TYPE="button"
onClick="toggleImage.display = none;">hide image</BUTTON>
<image id="toggleImage"
src=".\thePicture.bmp">
I also import javascript
<head>
<script language="JavaScript" src="PRO.js"
type="text/javascript"></script>
</head>
If code would be better there
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://calypso.tux.org/pipermail/ma-linux/attachments/20091021/f4d9d8fd/attachment.html
More information about the Ma-linux
mailing list