...

View Full Version : Using Drop-Menu to Control Frames



TNeston
10-23-2002, 09:49 PM
I am trying to use a drop-style menu system to control a frame-system, though I am running into problems with how the frame is loaded.

The top frame should always stay in place, while the content loads in underneath it. If I use a simple link such as text or an image, it works fine, the target=_parent solves this, but how can I control the loading using the above mentioned form link?

The navigation sits in the bottom frame, so essentially it is just reloading itself, no?

I am including the code in case anyone has an idea.

<-----------------------------index.html------------------------------------>

<html>
<head>
<title>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; [&nbsp;&nbsp; twelve02 &nbsp;&nbsp;] &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="styles.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
</head>
<frameset rows="130,*" frameborder="no" border="0" framespacing="0">
<frame src="top.html" name="topFrame" frameborder="No" scrolling="No" noresize="noresize" marginwidth="0" marginheight="0" id="topFrame" />
<frame src="bottom.html" name="mainFrame" frameborder="No" scrolling="No" noresize="noresize" marginwidth="0" marginheight="0" id="mainFrame" />
</frameset>
<noframes>
<body>
</body></noframes>
</html>

<------------------------------------------------------------------------->

<-----------------------------top.html------------------------------------>

<html>
<head>
<title>twelve02</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="twelve02styles.css" rel="stylesheet" type="text/css">

<style>
form {
margin: 0px;
}
</style>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>

</head>
<body bgcolor="#1A1B1C" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<center>
<table width="726" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="130" bgcolor="2E3234" width="242" valign="top"><img src="images/home/clearspacer.gif" width="1" height="130" border="0" align="top"></td>
<td valign="center" rowspan="2" bgcolor="2E3234" width="242" valign="top"><div align="center"><font color="#FFFFFF">This is the Top Frame</font></div></td>
<td bgcolor="2E3234" width="242" valign="middle"><div style="color:#B1DE4F; font-size:10; font-family: verdana, geneva, arial" "align="center">
</div></td>
</tr>
</table>
</center>
</body>
</html>

<--------------------------------------------------------------------------->

<-----------------------------bottom.html------------------------------->

<html>
<head>
<title>twelve02</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="twelve02styles.css" rel="stylesheet" type="text/css">

<style>
form {
margin: 0px;
}
</style>

<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>

<script language="JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}
//-->
</script>

</head>
<body bgcolor="#1A1B1C" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">

<center>
<table width="724" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="2E3234" valign="top">
<form name="ONE">
<select name="ONE" onChange="MM_jumpMenu('parent',this,1)" style="background-color:#1A1B1C; width:242px; height:16px; font-size:10; color:#B1DE4F; font-family: verdana, geneva, arial">
<option selected>These options, load the frame below</option>
<option value="enter.html"></option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
</select>
</form></td>

<td bgcolor="2E3234" valign="top">
<form name="TWO">
<select name="TWO" onChange="MM_jumpMenu('parent',this,1)" style="background-color:#1A1B1C; width:242px; height:16px; font-size:10; color:#B1DE4F; font-family: verdana, geneva, arial">
<option selected>These options, load the frame below</option>
<option value="index.html"></option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
</select>
</form></td>

<td bgcolor="2E3234" valign="top">
<form name="THREE">
<select name="THREE" onChange="MM_jumpMenu('parent',this,1)" style="background-color:#1A1B1C; width:242px; height:16px; font-size:10; color:#B1DE4F; font-family: verdana, geneva, arial">
<option selected>These options, load the frame below</option>
<option value="index.html"></option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
<option value="index.html">Link</option>
</select>
</form></td>

</tr>
<tr>
<td colspan="3" bgcolor="2E3234" valign="top" class="bodyText"><div align="center"><br><font color="#FFFFFF">This is the Bottom Frame.</font><br><br></div></td>
</tr>
<tr>
<td colspan="3" bgcolor="2E3234" height="16" valign="middle">
<form name="enter">
<select name="menu1" onChange="MM_jumpMenu('parent',this,1)" style="background-color:#2E3234; width:726px; height:16px; font-size:10; color:#B1DE4F; font-family: verdana, geneva, arial">

<option selected>supported BY:</option>
<option value="index.html"></option>
<option value="index.html"></option>
</select>
</form></td>
</tr>

<tr>
<td bgcolor="2E3234" width="242" valign="top">&nbsp;</td>
<td bgcolor="2E3234" width="242" valign="top">&nbsp;</td>
<td bgcolor="2E3234" width="242" valign="top">&nbsp;</td>
</tr>
</table>
</center>
</body>
</html>

<------------------------------------------------------------------------------>

Roy Sinclair
10-23-2002, 10:12 PM
You can use the target property with a form tag too.

TNeston
10-23-2002, 10:20 PM
I tried that, but it is still loading the new frame into the top, not the bottom...

PauletteB
10-24-2002, 02:47 AM
Try:

<select name="XXXXXXX" onChange="MM_jumpMenu('parent.mainFrame',this,1)"

on the three or so functions.

May work...

cg9com
10-24-2002, 03:47 PM
simply
onChange="top.frames['FrameName'].location=options[selectedIndex].value;">
would work

TNeston
10-24-2002, 04:37 PM
Thanks to everyone who posted their replies, I got it to work.

Thanks Again.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum