
April 24th, 2003, 09:45 AM
|
|
Senior Citizen
|
|
Join Date: Jan 2001
Location: leftcoast
Posts: 2,019
Time spent in forums: < 1 sec
Reputation Power: 15
|
|
|
<form>
Change
<select name="frame">
<option value="self">This</option>
<option value="left">Left</option>
<option value="right">Right</option>
<option value="bottom">Bottom</option>
</select> frame to
<select name="colors">
<option value="tan">Tan</option>
<option value="olive">Olive</option>
<option value="coral">Coral</option>
<option value="peru">Peru</option>
<option value="orange">Orange</option>
</select> background
<input type="button" value="now" onclick="docolor(frame,colors)">
</form>
function docolor(frame_sel, color_sel) {
var frame = frame_sel.options[frame_sel.selectedIndex].value;
var color = color_sel.options[color_sel.selectedIndex].value;
var obj = (frame == 'self') ? window : top;
obj[frame].document.body.style.background = color;
}
This assumes frames named 'left', 'right', 'bottom', and the one the code is written into. Untested.
|