View Full Version : CSS style switcher

01-18-2006, 10:35 AM
Hi all,

Since i've had such good experiences with this forum I'll try my luck with yet another problem.

I am building a site with a css styleswitcher. It's working with a 'normal' textlink to switch css styles.

I want to make it work within a dropdown list. I got it to work in Firefox (Mac) but not any other browsers for Mac (haven't tried PC yet though). So my question; does firefox use different coding for something like this?

this is the url of the site: http://www.m-go.nl/www2/index2.html

the dropdown menu is:

<form name="form2" id="form2">
<select name="menu1">
<option onclick="setActiveStyleSheet('style');return false;">Blue</option>

<option onclick="setActiveStyleSheet('style2');return false;">Urban decay</option>

and the 'normal' textlink is:

<a onclick="setActiveStyleSheet('style2');return false;" href="#">Change style to urban decay</a>
<a onclick="setActiveStyleSheet('style');return false;" href="#">Change style to blue</a>

any thoughts?

01-18-2006, 10:46 AM
It works in FF on PC. But not in IE because onclick event is not supported in option tag in IE. Use onchange in the select tag for wide cross-browser support.

<select name="menu1" onchange="setActiveStyleSheet(this.options[this.selectedIndex].value)">
<option value="style">Blue</option>
<option value="style2">Urban decay</option>

01-18-2006, 11:01 AM
tanx! :thumbsup: