[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Loading frames from select
>I have a pretty simple window with 2 frames - one has a form with a SELECT
>tag. Based on the user input from that select tag, I would like to load
>different HTML pages into the other frame.
I've been working on a similar problem. I adapted some code from the BigBus
magazine page (http://www.gulf.net/~ptlg/bb/content.html). I modified it so that
instead of going to a different window, JavaScript loads a document into a
target frame. Here it is:
<HTML>
<BODY>
<SCRIPT LANGUAGE="JavaScript">
<!-- Hide JavaScript code from older browsers
function update(form)
{
var thepath="file:///HD/Stuff/Vegetables%20GIFs/"
// if the user selects the "See young animal" option
if(form.select1[1].selected)
{
// update the animal frame with the appropriate animal picture
parent.frames[0].location=thepath + "calf.gif"
}
// if the user selects the "Hear the animal" option
if(form.select1[2].selected)
{
//update the animal frame with the appropriate picture
parent.frames[0].location=thepath + "cowsound.gif"
}
}
<!-- Done hiding JavaScript --> </SCRIPT>
<CENTER>
<FORM NAME="myform">
<SELECT NAME="select1" onChange="update(this.form)">
<OPTION>
<OPTION>See young animal
<OPTION>Hear sound animal makes
</SELECT>
</FORM>
</CENTER>
</BODY>
</HTML>
Hope this helps.
Sarah Withee
Internet consultant and multimedia software developer
withe009@maroon.tc.umn.edu