Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: Changing List Controls


Message #1 by "Mark Hembree" <mhembree@b...> on Tue, 8 Aug 2000 15:51:58
This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.

------_=_NextPart_000_01C00154.92507880
Content-Type: text/plain

You have to create an array.  I have a similar file attached that may help
you develop your array.

-----Original Message-----
From: Mark Hembree [mailto:mhembree@b...]
Sent: Tuesday, August 08, 2000 11:52 AM
To: javascript
Subject: [javascript] Changing List Controls


According to the book, a list control can have items dropped from the list 
or added to the list. What I need to do is to have an item on the list as 
SELECTED from a Java script. I have a form that I manipulate peices of data 
depending on a selection of another list control on the form. The list that 
I want to manipulate has all of the valid entries for a field, but I do not 
want the user to have to reselect a valid entry if they are updating 
another field. So I want the client side java script to place the SELECTED 
option on the appropriate list item.

Any ideas???



------_=_NextPart_000_01C00154.92507880
Content-Type: application/octet-stream;
	name="colorchangemethod.htm"
Content-Disposition: attachment;
	filename="colorchangemethod.htm"

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
	<title>Untitled</title>
<Script language="JavaScript">
function setColor(list) {
	var newColor = list.options[list.selectedIndex].value
	document.bgcolor = newColor
}
</script>
</head>

<body>
<FORM>
Select a background color:
<Select onChange="setColor(this)">
<option value="red">Stop
<option value="yellow">Caution
<option value="green">Go

</select>
</form>


</body>
</html>

------_=_NextPart_000_01C00154.92507880--

  Return to Index