Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi,
I created a drop down menu using java script for users to be able to select certain documents. The page the menu is located is a two frame page.
--frame #1 holds the drop down menu
--frame #2 is supposed to display the document they chose from the drop down menu.
How do I tell Javascript to send the document selected in the frame1 drop down, to frame 2?
Below is the code:
Wisdom Archive
Issue #1
Issue #2
Issue #3
Thanks in advance.
Jason

doh
Wisdom Archive
Issue #1
Issue #2
Issue #3
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wisdom Archive</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<div align="center">
<form name="jump">
<select name="menu">
<option value="http://www.wealthyapple.com/newsletter/030804/030711main.htm">Issue
#1</option>
<option value="http://www.wealthyapple.com/newsletter/052503/030525main.htm">Issue
#2</option>
<option value="http://www.wealthyapple.com/newsletter/030804/030711main.htm">Issue
#3</option>
</select>
<input type="button" onClick="location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"
value="GO">
</form>
</div>
</body>
</html>

Frameset (note ID attributes)
<html>
<head>
<title>mypage</title>
</head>
<frameset cols="110,*" frameborder=no border="0">
<frame name="left" ID="left" src="side.html" marginwidth="0"
marginheight="0" scrolling="no">
<frame name="right" ID="right" src="body.html" marginwidth="0"
marginheight="0" scrolling="auto">
<noframes><body>Viewing this page requires a frames
capable brower.
</body>
</noframes>
</frameset>
<body>
</body>
</html>
Corrected Javascript for side.html (top.right.location rather than just location)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Wisdom Archive</title>
<meta http-equiv="Content-Type" content="text/html;
charset=iso-8859-1">
</head>
<body>
<div align="center">
<form name="jump">
<select name="menu">
<option value="http://www.wealthyapple.com/newsletter/030804/030711main.htm">Issue
#1</option>
<option value="http://www.wealthyapple.com/newsletter/052503/030525main.htm">Issue
#2</option>
<option value="http://www.wealthyapple.com/newsletter/030804/030711main.htm">Issue
#3</option>
</select>
<input type="button" onClick="top.right.location=document.jump.menu.options[document.jump.menu.selectedIndex].value;"
value="GO">
</form>
</div>
</body>
</html>This worked for me.
I assume We don't have to lecture you on the dangers of using this approach to navigation...Use only if you don't care about search engines being able to crawl your page.-SN

SN got to this before me... I use the same method. He is right... bad mojo will be cast upon you and your website if you use frames and hope to have a search engine index the main page and not just one frame. Frames are best used around the intrAnet or personal projects.
Infinite Recursion

Actually, I was referring to the other danger...Using a dropdown menu for navigation...Since the links are in javascript, search engines' pattern recognition doesn't recognize them as links, so they don't get followed. The biggest problem I've had with search engines and frames is that they index the page without the frameset, so when somebody goes to your page from a search engine, there is no frameset so they can't navigate. This is fixable by a quick javascript.
I wasn't aware search engines had a hard time crawling frames in the first place; I always assumed it just found every document in the frameset and crawled each one separately...This is something I'll have to consider. I'm glad you posted.
-SN

Thanks SN and Infinite Recursion, and thanks for the code. It worked perfectly. I was expecting to get chewed out for not trying to hack it myself. I just dont know JavaScript, nor much programming in general other than a couple simple languages.
I was made aware of the threat having this code on the website could bring. However, as of right now, the website owner just wants to see how it "looks".
Does anyone have any suggestions for alternatives for web navigation. Yes, I'm new to web design as well. I was thinking of building a complete Flash/ColdFusion site, if that's any safer at all.
Jason

I am a fan of the other kind of dropdown menus, like that at www.sharingds.org. Other people like pull down menus, the kind at microsoft.com.
I'm not sure, but I think building a website in Flash would be even worse for a search engine to follow. Not to mention it's annoying when the whole thing is flash and takes forever to download.
Stick with HTML and javascript, your users will appreciate it.
-SN
P.S. Nobody chewed you out because you had a well defined problem and had included the source code of what you had already done. We mostly only chew out homework posters who just copy and paste their assignments.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |