Jump to content

Hide/Show Elements


sstangle73

Recommended Posts

Hi, onClick on a select element, I am trying to hide or show two different table rows. It does not seem to be working on internet explorer

 

Thanks for any help!

 

	function showMe (a, box) { 
  document.getElementById(a).style.display = "table-row";
  document.getElementById(a+"2").style.display = "table-row";
}
function hideMe (a, box) { 
  document.getElementById(a).style.display = "none";
  document.getElementById(a+"2").style.display = "none";
} 	

<tr><td><b>Account Type:</b><br><small>(If you are both a club and college coach, please select college coach)</small>:</td><td><SELECT NAME="type" size="3"><OPTION VALUE="coach" onClick="hideMe('hide', this)" >Coach/Manager</OPTION><OPTION VALUE="college_coach" onClick="showMe('hide', this)">College Coach</OPTION>
							</SELECT></div>
							</td></tr>
							<tr id="hide" style="display:none;"><td><b>College:</b></td><td colspan="2"><input type="text" name="college" value=""></td></tr>
							<tr id="hide2" style="display:none;"><td><b>Title:</b></td>
							<td><select name="gender" size="1">
						<option VALUE="men" >Men's</option><option VALUE="women" >Women's</option><option VALUE="both" >Men's and Women's</option>
							</select></div>
						</td>
						<td><select name="title" size="1"><OPTION VALUE="head" >Head Coach</OPTION><OPTION VALUE="assistant" >Assistant Coach</OPTION>
							</select></div>
						</td></tr>

here is the live demo if you would like to see it:

http://new.maddogmania.com/application/register.php

Link to comment
Share on other sites

Try creating two CSS styles, one for showing the element, one for hiding.  Use JavaScript to switch the styles.

 

CSS:

 

.show {
    visibility: visible;
}

.hide {
    visibility: hidden;
}

 

 

JavaScript to set class names for showing/hiding:

 

document.getElementById(a).className="show";
document.getElementById(a).className="hide";

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.