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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Show/Hide Panels Inline

Status
Not open for further replies.

DH

Programmer
Dec 8, 2000
168
0
0
Hello,

I am using the folling code to hide or display a panel depending on which radio button has been selected.

computer selected: display panel1 hide panel2
website selected: display panel2 hide panel1

Works fine except that when the 'website' radio button is selected 'panel2' displays but it is to far down. Is there a way for it to display right higher up the page like right under the radiobutton list?

Here is the code which can be tried:

Code:
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<script language="JavaScript">
<!--
function showImageFrom() {
	if (document.forms[0].RadioButtonList1[0].checked == true)
	{
		document.getElementById('Panel1').style.visibility = "visible";
		document.getElementById('Panel2').style.visibility = "hidden";
		
		document.getElementById('file1').value = "";
	}
	else 
	{
		document.getElementById('Panel1').style.visibility = "hidden";
		document.getElementById('Panel2').style.visibility = "visible";
		
		document.getElementById('txtURL').value = "";
	}
}
//-->
		</script>
	</HEAD>
	<body MS_POSITIONING="FlowLayout">
		<form name="Form1" method="post" action="WebForm3.aspx" id="Form1" enctype="multipart/form-data">
<input type="hidden" name="__VIEWSTATE" value="dDwtOTk4NTg2NzY0O3Q8O2w8aTwxPjs+O2w8dDxwPGw8ZW5jdHlwZTs+O2w8bXVsdGlwYXJ0L2Zvcm0tZGF0YTs+Pjs7Pjs+Pjs+GmyBKkraeMHu6tQLfwP9sbkrULU=" />

			<P>
				<span id="RadioButtonList1" onclick="showImageFrom();" style="font-family:Verdana;font-size:XX-Small;height:3px;width:150px;"><input id="RadioButtonList1_0" type="radio" name="RadioButtonList1" value="1" checked="checked" tabindex="1" /><label for="RadioButtonList1_0">Computer      </label><input id="RadioButtonList1_1" type="radio" name="RadioButtonList1" value="2" tabindex="1" /><label for="RadioButtonList1_1">Website</label></span></P>
			<P>
					<div id="Panel1">
	
						<input name="file1" id="file1" type="file" style="FONT-SIZE: 8pt; WIDTH: 336px; FONT-FAMILY: verdana; HEIGHT: 20px" tabIndex="2" size="36" />
						<input type="submit" name="btnUpdateBrowse" value="Upload" id="btnUpdateBrowse" tabindex="4" style="font-family:Verdana;font-size:XX-Small;height:20px;" />
					
</div></P>
			<P>
					<div id="Panel2">
	
						<input name="txtUrl" type="text" id="txtUrl" tabindex="3" style="border-color:Silver;border-width:1px;border-style:Solid;font-family:Verdana;font-size:XX-Small;height:20px;width:338px;" />
						<input type="submit" name="btnUpdateUrl" value="Upload" id="btnUpdateUrl" tabindex="5" style="font-family:Verdana;font-size:XX-Small;height:20px;" />
					
</div></P>
			<P>&nbsp;</P>
			<script language="javascript">
<!--
showImageFrom()
//-->
			</script>
		</form>
	</body>
</HTML>

Thanks for help.

DH
 
Yes there is. Instead of using the "visibility" property, use the "display" property and toggle them between "none" and "block".


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Thank you!

DH
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top