Jump to content

using onSelect to change div properties


AndyB

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.