Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NS and IE

Status
Not open for further replies.

wood

MIS
Aug 3, 2000
139
0
0
CA
In regards to the following FAQ:

faq216-335 Dynamically modifying List Boxes

Has anyone found a way to do this in Netsacpe?
 
I have the add() and remove() functions working in IE. Does anyone have an idea how to do this in Netscape?

Any help is appreciated.
 
Hi

If U've used innerHTML or OuterHTML in ur functions,
then it is not possible to do the same thing in NS.

Thanks
 
This is not exactly the same, but should work in both.
This one loads in a whole new array each time you make a selection from the parent select menu.

Code:
<html>
<head>
<title></title>
<script language=&quot;JavaScript&quot;>
<!--

function LoadDependent()
{
	var nSelect = document.Appointment.Treatment.selectedIndex;
	var nValue = document.Appointment.Treatment.options[nSelect].value;
	
	if (nValue == &quot;BLANK&quot;)
	{
		alert (&quot;You have selected a general service\n Please select a specific service instead\n&quot;);
	}
	else
	{
        // load in a conditional for every possible 
        // value from parent drop down. I am usually pulling this from a database.
		if (nValue == 1)
		{
			var myDynamicArray = new Array('this', 'that', 'those');
		}
		else
		{
			var myDynamicArray = new Array('GO', 'STOP', 'WAIT');
		}
  
  		// clear exitsting values in dynamic drop down
		// then load in new values
  		clearcombo();
  		for (var i = 0; i < 10; i++)
  		{
    		document.Appointment.Times.options[document.Appointment.Times.options.length] = new Option(myDynamicArray[i]);
  		}
		
		
	}
}

function clearcombo()
{
  for (var i=document.Appointment.Times.options.length-1; i>=0; i--)
  {
    document.Appointment.Times.options[i] = null;
  }
  document.Appointment.Times.selectedIndex = -1;
}






function fillcombo()
{
  for (var i = 0; i < 10; i++)
  {
    document.Appointment.Times.options[document.Appointment.Times.options.length] = new Option(&quot;display string &quot; + i, &quot;value &quot; + i);
  }
}

function submitForm()
{
	document.Appointment.action=&quot;test.html&quot;;
	document.Appointment.submit();
}
// -->
</script>
</head>
<body bgcolor=&quot;#FFFFFF&quot; leftmargin=&quot;0&quot; topmargin=&quot;0&quot; marginwidth=&quot;0&quot; marginheight=&quot;0&quot;>
				  <form action=&quot;reserve_reservation_send.asp&quot; method=&quot;POST&quot; name=&quot;Appointment&quot;> 
																		
                   
<br><br><br>					  
<table width=&quot;100%&quot; border=&quot;0&quot; cellspacing=&quot;0&quot; cellpadding=&quot;2&quot; align=&quot;center&quot;>
<tr> 
 <td> 
 <p><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Treatment Requested</b></font>:  
 
<select name=&quot;Treatment&quot; onChange=&quot;LoadDependent();&quot;>
	<option value=&quot;BLANK&quot;>Services
	<option value=&quot;BLANK&quot;>Body Therapies
	<option value=&quot;1&quot;>  - Ahhh-Peppermint Wrap
	<option value=&quot;2&quot;>  - Aroma-fusion Body Polish
	<option value=&quot;3&quot;>  - Herbal Detox Wrap
	<option value=&quot;4&quot;>  - Shiatsu
	<option value=&quot;5&quot;>  - The Balance Pack
</select>
</p>
	</td>
</tr>
<tr>
	<td><font face=&quot;Arial, Helvetica, sans-serif&quot; size=&quot;2&quot;><b>Please enter a time:</b></font>
<select name=&quot;Times&quot;>
	<option value=&quot;&quot;>Please Choose a time</option>
	<option value=&quot;&quot;></option>
	<option value=&quot;&quot;></option>
	<option value=&quot;&quot;></option>
</select>
	</td>
</tr>
</table>
			<p align=&quot;center&quot;><font face=&quot;Arial, Helvetica, sans-serif&quot;> </font><font face=&quot;Arial, Helvetica, sans-serif&quot;><b> 
              </b></font></p>
          </td>
        </tr>
      </table>
</html>
 
FhHouse,

I'm off for today, I will give it a try tomorrow morning and let you know the outcome.

Thanks!
 
FhHouse,

Thanks, this works great!

One more question... Do the values equal the same as the names now. Before, I had the values silghtly different from the text that was shown.

For example
...
<option value=&quot;*ALL&quot;>All</option> (before rewriting)

Does this now means it would be like so...
<option value=&quot;All&quot;>All</option>

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top