Topic: How to jump menu select a new style to same webpage (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=10846" title="Pages that link to Topic: How to jump menu select a new style to same webpage (Page 1 of 1)" rel="nofollow" >Topic: How to jump menu select a new style to same webpage <span class="small">(Page 1 of 1)</span>\

 
dulci
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2002

posted posted 10-30-2002 23:09

Like mentioned in the title,

How can you select from a jump menu a new style to the page, or more directly, to a div id named=Block6. I wish to change between the background color from red to green and visa versa. At the same time, how can this jump menu selection hide some layers and deselect the other layers? Thanks!

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 10-30-2002 23:22

dulci: Welcome. You could achieve this with a bit of JavaScript.

Stylesheet switching:

How do I change stylesheets dynamically?

if you want some things to appear in some styles but not in others just set their style to display: none in your stylesheet.

See this:

How do I toggle the visibility of layers?

And as you are new here see:
http://faq.ozoneasylum.com/394/

___________________
Emps

FAQs: Emperor

dulci
Obsessive-Compulsive (I) Inmate

From:
Insane since: Oct 2002

posted posted 10-31-2002 17:29

Great , the css switching and visibility is working now. But it can only be happened once and no more!
I.e. cos the select box (with style 1 and style 2) only has one onChange=... After that, it will not change back because it will always use e.g. from style 1 to 'written style' and style 2 to 'same written style'.

How can i give each style/link its own actions?

Code:

<div id="Block1"> Choose a style:
<select name="Meny" onChange="MM_jumpMenu('parent',this,0);MM_changeProp('Block6','','style.backgroundColor','#009900','DIV')">
<option value="#" selected>Stil 1</option>
<option value="#">Stil 2</option>
</select>
</div>


mobrul
Bipolar (III) Inmate

From:
Insane since: Aug 2000

posted posted 11-01-2002 16:55

I'm writing this quick at work, so I don't have time to write code, but basically you want your onchange to call a function.
That function will then check which of your two options are selected and then alter your styles appropriately.

You can find which option is selected with:
document.formID.selectID.optionID.selected
or
document.getElementbyId('optionID').selected
or
some other way that Slime, Bugs or some other DOM genius can tell you about...

A simple if...then...else statement ought to do you just fine.




Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 11-02-2002 05:14

dulci: I'd try something like:

code:
<form action="javascript:changeStyle(document.FORM.SELECT.options[document.FORM.SELECT.selectedIndex].value); return false;"



or something like that.

___________________
Emps

FAQs: Emperor



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu