Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radio button and visible input control

Status
Not open for further replies.

jimmyweb

Programmer
Joined
Dec 9, 2004
Messages
37
Location
US
Hi Friends,
I created a 3 series radio button on page. when users checked one ID radio button, system will display a
Invisibl[ changed to visible] input box to ask user enter data. I used a javaScript to control. It is not work.From explore status button-it show
that object expected. How to fix this error. It seems the function does not fired when users check that radio button.

Thanks for any help
Jimmy
--my code--
<html><head><title></title>
<style>
.Invisible
{
visibility: hidden;
}
.Visible
{
visibility: visible;
}
</style>
<script language="JavaScript">
function changeVisibility(s) {
alert("how are u");
txtValue=s.value;
alert("get value---" + txtValue=s.value);

var ttxtValue = document.activeoption.ms_report.value;
alert("get value2222---" + txtValue=s.value);
if ( (txtValue == "Client") || (txtValue == "Product") ){

document.getElementById("p_txtValue1").className="Visible";
} else {
document.getElementById("p_txtValue1").className="Invisible";
}

}
</script>
</head>'
<form method="post" name="activeoption" action="result.html" >;
<input type="radio" name="ms_report" value="Group" ">
<b>One Client</b>;
<input type="radio" name="ms_report" value="Company" )">
<b>One Client</b>;

<input type="radio" name="ms_report" value="Show Client" onclick="changeVisibility(this)">
<b>One Client</b>;
<input type="text" name="ms_client_id" id="p_txtValue1" size="6" maxlength="6">;
</form></html>
 
this is your code, just cleaned up a bit:
Code:
<html>
	<head>
		<title>test</title>
		
		<style>
		.Invisible {visibility: hidden;}
		.Visible {visibility: visible;}
		</style>
		
		<script language="JavaScript">
		function changeVisibility(s) {
			txtValue = s.value;

			if ( (txtValue == "Client") || (txtValue == "Product") ){
				document.getElementById("p_txtValue1").className="Visible";
			} else {
				document.getElementById("p_txtValue1").className="Invisible";
			}
		}
		</script>
	</head>
	<body>
		<form method="post" name="activeoption" action="result.html" >
			<input type="radio"  name="ms_report" value="Group" onclick="changeVisibility(this)" />
		<b>One Client</b>
		<input type="radio"  name="ms_report" value="Company" onclick="changeVisibility(this)" />
		<b>One Client</b>
		<input type="radio"  name="ms_report" value="Client"  onclick="changeVisibility(this)" />
		<b>One Client</b>
		<input type="text"  name="ms_client_id" id="p_txtValue1" size="6" maxlength="6" />
		</form>
	</body>
</html>


-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top