javascript/html frames question

Mski0032

Member
Aug 13, 2002
37
0
0
if i have a javascript menu in the A frame, how do i get the links to open up in the B frame???



mski
 

Mski0032

Member
Aug 13, 2002
37
0
0
based on that comment, i think ill just have the bar that was in the top frame just be on every page... not be in a different frame.... but if you know how to do it... still let me know... thanks
 

Gooberlx2

Lifer
May 4, 2001
15,381
6
91
Here's an example I found a long time ago. Mind you, this uses a form, obviously, and not links.

I you're just using links then do something like:
<a href ="tryhtml_frame_a.htm" target ="main">Link a</a>
<a href ="tryhtml_frame_b.htm" target ="main">Link b</a>
<a href ="tryhtml_frame_c.htm" target ="main">Link c</a>
...in your menu html page.

***** FRAMESET HTML *****
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; iso-8859-1">
<title>Frameset</title>
<meta name="FORMATTER" content="Microsoft FrontPage 2.0">
</head>
<frameset rows="13%,87%,*" frameborder="0" border="0" framespacing="0">
<frame marginwidth="0" marginheight="0" src="menu.html" name="menu" noresize scrolling="no">
<frame marginwidth="0" marginheight="0" src="main.html" name="main" noresize scrolling="yes">
<noframes>
<body>
<p>This web page uses frames, but your browser doesn't support them.</p>
</body>
</noframes>
</frameset>
</html>


***** MENU *****
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML lang="en">
<html>
<head>
<title>Java Script Menu</title>

<script language="JavaScript">
function gothere()
{
if (document.myform.gimmie.options[1].selected)
parent.main.location='http://www.mysticdreams.com/player/freestuff/dropdown/page3.html'
if (document.myform.gimmie.options[2].selected)
parent.main.location='http://www.mysticdreams.com/player/freestuff/dropdown/page1.html'
if (document.myform.gimmie.options[3].selected)
parent.main.location='http://www.mysticdreams.com/player/freestuff/dropdown/main.html'
if (document.myform.gimmie.options[4].selected)
parent.main.location='http://www.mysticdreams.com/player/freestuff/dropdown/page2.html'
if (document.myform.gimmie.options[5].selected)
parent.main.location='http://www.mysticdreams.com/player/freestuff/dropdown/code.html'
}
</script>

</head>
<body bgcolor="#0000FF" text="#000000">
<CENTER>
<FORM NAME="myform">
<SELECT NAME="gimmie" SIZE="1">
<OPTION> --> Choose Your Destination <--
<OPTION>Page Three
<OPTION>Page One
<OPTION>Main Page
<OPTION>Page Two
<OPTION>Grab the Code
</SELECT>
<INPUT TYPE="button" VALUE="go there" onClick="gothere()">
</FORM></CENTER>
</body>
</html>

***** MAIN *****
...stuff.....

But yeah, frames are evil nowadays. There's better ways to do things. check out w3schools. Not a bad site, but it doesn't say anything about frame alternatives. I think tables can be alternatives, or tablets or...something...I don't remember.