Jump to content


Photo

select


  • Please log in to reply
2 replies to this topic

#1 Hellusius

Hellusius
  • Members
  • PipPipPip
  • Advanced Member
  • 55 posts

Posted 04 August 2006 - 10:07 PM

not sure if this is this is allowed, but its sure as heck is not work

<select name="background" onChange="document.bgcolor.color=value">
 <optgroup label="Background Chooser">
  <option name="color" value="5577AA">Default</option>
  <option name="color" value="7799DD">Lightblue</option>
  <option name="color" value="335588">Darkblue</option>
  <option name="color" value="5577AA">Black</option>
 </optgroup>
</select>

any suggestions, on how I could do it, or what I did wrong

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 04 August 2006 - 10:31 PM

working script found with Google: http://www.javascrip....com/backg.html
Legend has it that reading the manual never killed anyone.
My site

#3 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 05 August 2006 - 10:07 AM

Use this.value to get the value of the current selected item in the list:
<select name="background" onChange="document.bgColor = this.value">
 <optgroup label="Background Chooser">
  <option name="color" value="#5577AA">Default</option>
  <option name="color" value="#7799DD">Lightblue</option>
  <option name="color" value="#335588">Darkblue</option>
  <option name="color" value="#5577AA">Black</option>
 </optgroup>
</select>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users