Stylesheet Changer Dropdown

<script type="text/javascript">
function swapStylesheet()
{
	var index = document.getElementById("stylesheetSelect").selectedIndex;
	var chosenStylesheet = "defaultStyle";
	// replace "defaultStyle" with the name of your
	// default stylesheet

	switch(index)
	{
		case 0:
			chosenStylesheet = "firstOption";
			// replace "firstOption" with the
			// name of the first stylesheet
			// option

			break;
		case 1:
			chosenStylesheet = "secondOption";
			// see above

			break;

		// add a case n for each stylesheet option you add to the dropdown menu
	}

	setActiveStyleSheet(chosenStylesheet);
}

</script>
<form>
	<select id="stylesheetSelect" onChange="swapStylesheet()">
		<option>Default Stylesheet</option>
		<option>Special Stylesheet</option>
	</select>
</form>

Put the part somewhere in the of the document and put the part wherever you want the dropdown to appear.

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: