Jump to content


Photo

using onSelect to change div properties


  • Please log in to reply
6 replies to this topic

#1 AndyB

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

Posted 12 October 2006 - 12:54 AM

The thread title says what I wish I could do with both IE and Firefox (and I don't even care about the other browsers).

Full example viewable source at http://www.halfadot....ick-colors.html

Basically I want to show selectable foreground/background colours in a specific div. The syntax below sort of works with IE except it declines to show the font size as defined, there are no colour changes with Firefox but the text is shown the right size. The code is pretty trivial ... except it doesn't work. Any javascript/CSS wizards want to point me in the right direction?

select onChange='document.getElementById("testx").style.color = this.value;'

Legend has it that reading the manual never killed anyone.
My site

#2 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 12 October 2006 - 01:36 AM

Well, the FF problem is simple enough -- your values aren't valid HTML colours, since the lack the leading '#'.  IE will let you get away with just about anything ;-)  Not sure about the font-size issue, I don't see what you're talking about.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#3 AndyB

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

Posted 12 October 2006 - 02:08 AM

Thanks.

Unsurprisingly adding # to the colour definitions solved the problem with FF ... puts on dunce cap  :o

IE (still) refuses to pick up the inline font size in the div definition. I wonder why?
Legend has it that reading the manual never killed anyone.
My site

#4 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 12 October 2006 - 02:14 AM

i don't see what you mean - they both appear at the same size in my IE and FF.  do you mean the positioning?  i notice FF's text is centered both vertically and horizontally, whereas IE is only horizontally centered.

#5 AndyB

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

Posted 12 October 2006 - 02:30 AM

Well, that's weird.  When I view with FF the font looks about right for the declared size of 32px.  Seen with IE6, the font size looks about 12px high.
Legend has it that reading the manual never killed anyone.
My site

#6 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 12 October 2006 - 02:36 AM

weird indeed.  looks to me to be about 32px in IE6win.

#7 AndyB

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

Posted 12 October 2006 - 10:57 AM

weird indeed.  looks to me to be about 32px in IE6win.


That's good enough for me. I'll plonk it on the client's site and if she says nothing I'll assume either she doesn't notice or that it works for her as well.
Legend has it that reading the manual never killed anyone.
My site




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users