Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

easy css problem

Posted on 2004-04-15
2
Medium Priority
?
223 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
2 Comments
 
LVL 4

Accepted Solution

by:
monolith_888 earned 220 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

JavaScript has plenty of pieces of code people often just copy/paste from somewhere but never quite fully understand. Self-Executing functions are just one good example that I'll try to demystify here.
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
HTML5 has deprecated a few of the older ways of showing media as well as offering up a new way to create games and animations. Audio, video, and canvas are just a few of the adjustments made between XHTML and HTML5. As we learned in our last micr…
Suggested Courses

916 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