[Javascript] show hide a text when checking a checkbox ?

Muchacho, Laurent (TWIi London) LMuchacho at twii.net
Wed Jun 6 06:32:31 CDT 2001


Hi 

The best way I found to do that it's to include your text in a <div
id="something"> and show it or hide it when you click on the check boxe
there is the code to do what you want sorry it's not with checkbox but with
radio button I think that shouldn't be a probleme 

good luck 

Persistenz

<HTML>
<HEAD>

</HEAD>
<BODY>
<table cellpadding="0" cellspacing="0" border="0" width="200">
	<tr>
	<td class="normalBlack" align="right">show</td>
	<td align="right"><form id=form1 name=form1><input type="radio"
name="radio1" onClick="showButton('nextred')"></td>
	</tr>
	<tr>
	<td class="normalBlack" align="right">hide</td>
	<td align="right"><input type="radio" name="radio1"
onClick="hideButton('nextred')"></form></td>
	</tr></table>

	<div id="nextred" style="position:absolute; left: 200px; top: 200px;
width: 341px; height: 16px;visibility:hidden;z-index: 100;">
	<table cellspacing="0" cellpadding="5" border="1" width="341">
	<tr>
	<td>dsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf
ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha
kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of
hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j
j of     hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf
ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha
kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of
hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j
j of     hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf
ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha
kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j j of
hdsha kjhf kalhf ildhbiuhad hia j j of     hdsha kjhf kalhf ildhbiuhad hia j
j of     hdsha kjhf kalhf ildhbiuhad hia j j of     h</td>
	</tr>
	</table></div>
	<script language="JavaScript">
	<!--
	var b = navigator.appName
	if (b=="Netscape") this.b = "ns"
	else if (b=="Microsoft Internet Explorer") this.b = "ie"
	else this.b = b
	this.v = parseInt(navigator.appVersion)
	this.ns5 = (this.b=="ns" && this.v==5)
	ns4 = (document.layers)? true:false
	ie4 = (document.all)? true:false


	var layerRef,styleRef 
		if (ns5){
		layerRef = "document.getElementById('"
		styleRef = "').style."
		}
		else{
		layerRef = (document.all) ? "" : "document.";
		styleRef = (document.all) ? ".style." : ".";
		}

	function showButton(buttonName){
			eval(layerRef + buttonName + styleRef + "visibility
= 'visible'");
	}
	function hideButton(buttonName){
			eval(layerRef + buttonName + styleRef + "visibility
= 'hidden'");
	}
	//-->
	</script>


<P>&nbsp;</P>

</BODY>
</HTML>


-----Original Message-----
From: yahress nataf [mailto:yna54 at hotmail.com]
Sent: 05 June 2001 18:41
To: javascript at LaTech.edu
Subject: [Javascript] show hide a text when checking a checkbox ?


How to do it ?
Thanks
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com


_______________________________________________
Javascript mailing list
Javascript at LaTech.edu
http://www.LaTech.edu/mailman/listinfo/javascript




More information about the Javascript mailing list