anton1
10-05-2003, 05:17 AM
is there a script available for replacing a checkboxes with images? ("off" and "on")
pls help
anton1
pls help
anton1
|
Click to See Complete Forum and Search --> : graphic checkbox anton1 10-05-2003, 05:17 AM is there a script available for replacing a checkboxes with images? ("off" and "on") pls help anton1 Fang 10-05-2003, 06:32 AM Clicking the image or text will change the state of the control. The hidden input value can be read when the form is sent. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <title>Image checkbox replacement</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript"> //<![CDATA[ <!-- var myImg=[]; myImg[0]=new Image(20, 20); myImg[0].src="Images/t1.gif"; myImg[1]=new Image(20, 20); myImg[1].src="Images/t2.gif"; function SwapImage() { var oBox=document.getElementById('box'); var oInput=document.getElementById('fakebox'); if(oBox.src==myImg[0].src) { oBox.src=myImg[1].src; oInput.value="true"; } else { oBox.src=myImg[0].src; oInput.value="false"; } } //--> //]]> </script> </head> <body> <form id="myform" action="#"> <img onclick="SwapImage();" src="Images/t1.gif" id="box" width="20" height="20" alt="fakebox control"><span onclick="SwapImage();" style="cursor:pointer;"> Select something</span> <input type="hidden" id="fakebox" value="false" /> </form> </body> </html> anton1 10-05-2003, 06:44 AM yes, its working thanks (bedankt grote meester uit voorburg :-)) anton1 Fang 10-05-2003, 07:23 AM Voorhout niet Voorburg :p webdeveloper.com
Copyright Internet.com Inc., All Rights Reserved. |