Solved

easy css problem

Posted on 2004-04-15
2
219 Views
Last Modified: 2010-04-06
hi im trying to show an other box when a user selects other form the list box.. this doesnt work any help would be greatly appreciated..

    <td width="289" align="left" valign="middle"><select name="referrer">
<option value="Yellow Pages On-Line" onClick="document.getElementById('hideother').style.display='none';">Yellow Pages On-Line</option>
<option value="Yellow Pages" onClick="document.getElementById('hideother').style.display='none';">Yellow Pages</option>
<option value="Referred by a friend" onClick="document.getElementById('hideother').style.display='none';">Referred by a friend</option>
<option value="Referred by a colleague" onClick="document.getElementById('hideother').style.display='none';">Referred by a colleague</option>
<option onClick="document.getElementById('hideother').style.display='';">Search Engine</option>
<option onClick="document.getElementById('hideother').style.display='';">Magazine</option>
<option value="Trade Show">Trade Show</option>
<option onClick="document.getElementById('hideother').style.display='';">Other</option>
                        </select></td><td id="hideother" style="display: none;"><input type="text" name="referrer" size="20"></td>
0
Comment
Question by:chizzy60
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 4

Accepted Solution

by:
monolith_888 earned 55 total points
ID: 10838991
Here you go chizzy, use this - a muc simpler and streamlined approach to achieve your results

-hth
monolith_888
==================:

<html>
<head>
<title>Hide Other Box</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script>
function checkList()
      {
      var theFormSelect = document.myForm.referrer;
      var otherTextFld = document.getElementById('hideother');

      if(theFormSelect.options[theFormSelect.options.selectedIndex].value == 'Other')
            otherTextFld.style.display = "";
      else
            otherTextFld.style.display = "none";
      }
</script>
</head>

<body>
<form name="myForm">
<table><tr>
<td align="left" valign="middle">
<select name="referrer" onChange="checkList()">
<option value="Yellow Pages On-Line">Yellow Pages On-Line</option>
<option value="Yellow Pages">Yellow Pages</option>
<option value="Referred by a friend">Referred by a friend</option>
<option value="Referred by a colleague">Referred by a colleague</option>
<option value="Search Engine">Search Engine</option>
<option value="Search Engine">Magazine</option>
<option value="Trade Show">Trade Show</option>
<option value="Other">Other</option>
</select>
</td>
<td><input type="text" name="referrerTxt" size="20" id="hideother" style="display:none;"></td>
</tr></table>
</form>
</body>
</html>
0
 

Author Comment

by:chizzy60
ID: 10839411
i ended up working it out similar to that.. but i had to make the display set to block to work on ie. and safari

thanks
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Matthew
I am a very big proponent of technology compliance standards and strive to meet such criteria in all of my work. That includes my site, which is 100% XHTML 1.0 compliant as determined by the World Wide Web Consortium. https://www.matthewstevenkel…
Shoutout to Emily Plummer (http://www.experts-exchange.com/members/eplummer26.html) for giving me this article! She did most of it, I just finished it up and posted it for her :)    Introduction In a previous article (http://www.experts-exchang…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question