Jump to content

Archived

This topic is now archived and is closed to further replies.

AndyB

using onSelect to change div properties

Recommended Posts

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.com/temp/pick-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?

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
weird indeed.  looks to me to be about 32px in IE6win.

Share this post


Link to post
Share on other sites
[quote]weird indeed.  looks to me to be about 32px in IE6win.[/quote]

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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.