Click to See Complete Forum and Search --> : Help with form selection options in a frameset
akasha7585
08-08-2003, 04:43 PM
I have a frameset with two frames. The top one has a drop down list. I want the user to be able to select on of the options from the drop down list and it to load of page in the lower frame.
Can this be done? Any help would be appreciated.
AdamBrill
08-08-2003, 04:46 PM
You can change the location of a different frame like this:
top.framename.document.location="wherever.htm";
Now you just have to put that in your script. ;) If you have any problems with it, let me know...
akasha7585
08-08-2003, 04:48 PM
Thanks for that. I have tried so many different scripts that I don't have a clue what is going on with my page now. Can you recommend a script to use?
AdamBrill
08-08-2003, 04:57 PM
You can use something like this:<select onchange="top.otherframename.location=this.value;">
<option value="http://www.yahoo.com">Yahoo!</option>
<option value="http://www.google.com">Google</option>
<option value="http://www.amazon.com">Amazon</option>
</select>
akasha7585
08-08-2003, 05:07 PM
Here is the script I had orginally...Is this right?
<script language="javascript">
function doSel(obj)
{
for (i = 1; i < obj.length; i++)
if (obj[i].selected == true)
eval(obj[i].value);
}
</script>
<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="location.href='http://www.amazon.com'">Amazon.com</option>
<option value="location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>
AdamBrill
08-08-2003, 05:23 PM
This part:
<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="location.href='http://www.amazon.com'">Amazon.com</option>
<option value="location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>
Would look like this:
<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="top.framename.location.href='http://www.amazon.com'">Amazon.com</option>
<option value="top.framename.location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>
You have to change the "framename" to the name of the frame that should change...
akasha7585
08-08-2003, 05:36 PM
Ok, maybe I made this a little too complicated for my own good..LOL
The user starts out on a page..that page has and Iframe - which links to the page with the frameset. The frameset has a top frame (which will have the drop down) then the bottom frame is where that page should show up.
Did I screw things up with the Iframe?
This is what the IFrame looks like
<IFRAME SRC="main-iframe.html" marginheight="0" marginwidth="0" scrolling="Auto" width="550" height="500" TITLE="Iframe" border="0" frameborder="0">
</IFRAME>
Then main-iframe.html has this on it
<frameset frameborder="0" rows="550,*" framespacing="0" border="0" framespacing="0">
<frameset frameborder="0" rows="29,*" framespacing="0" border="0" framespacing="0">
<frame name="nav" src="drop-down-list.html" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" noresize>
<frame name="info" src="page-to-change.html" marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" noresize>
</frameset>
</frameset>
The javascript sits on drop-down-list.html.
<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="top.framename.location.href='http://www.amazon.com'">Amazon.com</option>
<option value="top.framename.location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>
Am I too big for my britches?
AdamBrill
08-08-2003, 10:02 PM
Tsk, tsk, you left out an important detail. :D If you change this:<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="top.framename.location.href='http://www.amazon.com'">Amazon.com</option>
<option value="top.framename.location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>to this:<form name="jsMenu">
<select name="jsSelList" size="1" onchange="doSel(this)">
<option selected value>Select a page, and Gone!</option>
<option value="parent.framename.location.href='http://www.amazon.com'">Amazon.com</option>
<option value="parent.framename.location.href='http://www.yahoo.com'">Yahoo</option>
</select>
</form>It should work fine. :) Let me know...
akasha7585
08-11-2003, 12:40 PM
What do I put in the ".location" I am getting a "null value" error
AdamBrill
08-11-2003, 12:47 PM
Did you change the 'framename' to whatever your frame name is? If not, then change that and see if it works...
akasha7585
08-11-2003, 12:51 PM
Yes I did
I put "info" there which I got from here
<frame name="info" src="folder/main.html" marginwidth="0" marginheight="0" scrolling="auto" frameborder="0" noresize>
That is right, right? :)
AdamBrill
08-11-2003, 12:57 PM
Originally posted by akasha7585
That is right, right? :) Right. ;)
Ok, one more thing to try. Change all of these:
top.framename.location.href
to these:
top.framename.location
If it still doesn't work, why don't you zip up the couple pages for the frames and top page and let me take a look...
akasha7585
08-11-2003, 01:08 PM
Still no luck. I zipped up the files for you..here they are.
The main page is iframe-page.html
AdamBrill
08-11-2003, 01:44 PM
Try these... I used my script instead, since it is quite a bit simpler. ;)
akasha7585
08-11-2003, 01:48 PM
Perfect!!! :D
Thank you so much for your help! ;)
AdamBrill
08-11-2003, 02:11 PM
No problem. I'm glad I could help. ;)
BTW, I fixed your frameset while I was changing things..... just so you know. :)