• Post Reply Bookmark Topic Watch Topic
  • New Topic

New Option with CSS...Possible???  RSS feed

 
MedevH Mediev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to specify (with inhertance & prototypes maybe) a new <option> element that has a specified CSS class attached to it?
Statically i can do this with
<option class="ClassName">
but i need to be able to do this dynamically.
Is this possible or am i digging for gold in a salt mine??
PLEASE HELP!!!
 
MedevH Mediev
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My Current Code...
(Yes i am aware that one line i commented out)
It doesn't work either way...
*****since this posting accpetor won't take my OnClick event you will need to add it to the input button to call the function******

[ February 04, 2003: Message edited by: MedevH Mediev ]
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving to the JavaScript Forum.
 
christoph weingarten
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
standart javascript-syntax is:
document.formName.elementName.options[#].attribute = "something";
so what you could try is:
document.form.CSSSelect.options[0].class = "silver";
please tell me, whether it works. it would be intersting to know
regards
christoph
 
christoph weingarten
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
well, i tried it myself. you can't change the class-attribute auf this object with js.
but you CAN set the class-attribute of your select-box. so , this will work fine:
<select name="CSSSelect" class="gold">
christoph
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!