Solved

easy css problem

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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
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.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now