DMWFlea
08-26-2003, 12:33 PM
I have an option Box in my page that once change I would like it to load the correct page thats in the options value in to an iframe useing javascript can anybody tell me how to active this
Thanks
P.S My Code is Below
_script.js
var Hair =new Array(
new Array(1,"Ladies","hair_ladies.html"),
new Array(2,"Colouring","hair_colouring.html"),
new Array(3,"Highlights & Lowlights","hair_highlights.html"),
new Array(4,"Mens","hair_mens.html"),
new Array(5,"Treatments","hair_treatments.html"),
new Array(6,"Permanent Waving","hair_waveing.html"),
new Array(7,"Hair Straightening","hair_straight.html"),
new Array(8,"Hair Extenstions","hair_extensiotn.html")
);
function swapOptions(the_array_name)
{
var numbers_select = window.document.form.subservies;
var the_array = eval(the_array_name);
setOptionText(window.document.form.subservies,the_array);
}
function setOptionText(the_select, the_array)
{
the_select.length=the_array.length;
the_select.options[0].text = "Please Select One";
for (c=0; c < the_array.length; c++)
{
the_select.options[c].text = the_array[c][1];
alert(the_select.options[c].value = the_array[c][2]);
}
}
function loadiframe(the_value)
{
alert(the_value);
window.document.iframe.details.src = the_value;
}
price_list.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script src="pricelst.js"></script>
<body>
<form name="form">
<select name="services" onChange="swapOptions(window.document.form.services.options[selectedIndex].text);">
<option selected>Select Service</option>
<option>Hair</option>
</select>
<select name="subservies" onChange="loadiframe(window.document.form.subservies.options[selectedIndex].value);">
<option selected>--------------</option>
</select>
</form>
<iframe name="details" id="details"></iframe>
</body>
</html>
Thanks
P.S My Code is Below
_script.js
var Hair =new Array(
new Array(1,"Ladies","hair_ladies.html"),
new Array(2,"Colouring","hair_colouring.html"),
new Array(3,"Highlights & Lowlights","hair_highlights.html"),
new Array(4,"Mens","hair_mens.html"),
new Array(5,"Treatments","hair_treatments.html"),
new Array(6,"Permanent Waving","hair_waveing.html"),
new Array(7,"Hair Straightening","hair_straight.html"),
new Array(8,"Hair Extenstions","hair_extensiotn.html")
);
function swapOptions(the_array_name)
{
var numbers_select = window.document.form.subservies;
var the_array = eval(the_array_name);
setOptionText(window.document.form.subservies,the_array);
}
function setOptionText(the_select, the_array)
{
the_select.length=the_array.length;
the_select.options[0].text = "Please Select One";
for (c=0; c < the_array.length; c++)
{
the_select.options[c].text = the_array[c][1];
alert(the_select.options[c].value = the_array[c][2]);
}
}
function loadiframe(the_value)
{
alert(the_value);
window.document.iframe.details.src = the_value;
}
price_list.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<script src="pricelst.js"></script>
<body>
<form name="form">
<select name="services" onChange="swapOptions(window.document.form.services.options[selectedIndex].text);">
<option selected>Select Service</option>
<option>Hair</option>
</select>
<select name="subservies" onChange="loadiframe(window.document.form.subservies.options[selectedIndex].value);">
<option selected>--------------</option>
</select>
</form>
<iframe name="details" id="details"></iframe>
</body>
</html>