Solved

easy css problem

Posted on 2004-04-15
2
218 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 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

Industry Leaders: 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

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

680 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