JavaScript Forum JS Made Easy: Free JavaScripts Tutorials Example Code
About This Product
FontsMadeEasy.com
 
The Business Internet
Find it on This page:
 
| Over 5000 Free Fonts | Tutorials | Javascript Forum | Other Javascript Resources | Cheat Sheet

     
Jsmadeeasy Forums Home   Search   Login   Register   Member List  
JS Made Easy  > JavaScript programming  > Using Frames with combo boxes?  
 
Display using:  
Previous Thread :: Next Thread 
 Author Thread: Using Frames with combo boxes?
BoomerDan is not online. Last active: 7/28/2004 3:52:08 PM BoomerDan
Joined: 28 Jul 2004
Total Posts: 3
 
Using Frames with combo boxes?
Posted: 02 Jul 2002 09:01 AM
Hello, I am developing a two frame site (each named "top" and "bottom"). In the top frame, called "top", I have 4 comboboxes with a few selection that drop down. I'm using the bottom frame, called "bottom", to display an html page based on the users selection in the top frame. I'm using a JavaScript to try and do this. My page worked without frames, but apparently I'm missing something to move this into the framed site.

Below is the code I'm using as the top frame.


top.html:

<html>
<head>

<script language="Javascript">
<!--

function goToURL(form) {

var index = form.dropdownmenu.selectedIndex
if (!index == "")
{
parent.frames.bottom.location=form.dropdownmenu.options[index].value
}

//-->
</script>

</head>

<body topmargin=0 leftmargin=0 bgcolor=darkblue>

<table border=0 cellspacing=0 cellpadding=0 width=100%>

<tr>

<td valign=top width=10% align=middle>

<h3><font color=white size=2 face=Arial,Times,Courier>EMF</font></h3>

</td>

<td width=90% align=middle>

<form name="menuform">
<select name="dropdownmenu" onChange="goToURL(this.form)">
<option value="">OS Reports Available
<option value="total_mem_usage.html">Total Memory Usage
<option value="total.cpu.util.html">Total CPU Utilization
</select>

<select name="dropdownmenu" onChange="goToURL(this.form)">
<option value="" selected>DB Reports Available
<option value="listener_status.html">Listener Status
<option value="instance_status.html">Instance Status
</select>

<select name="dropdownmenu" onChange="goToURL(this.form)">
<option value="" selected>Application Reports Available
<option value="total_mem_usage.html">"Total e*Gate Application Memory Usage
<option value="total_cpu_util.html">Total e*Gate Application CPU Utilization
</select>

<select name="dropdownmenu" onChange="goToURL(this.form)">
<option value="" selected>Transaction Reports Available
<option value="867_810_814_flow.html">867_810_814 Flow
<option value="814_01_16.html">814_01 and 814_16 Flow
<option value="867_03_cis+.html">867_03 to CIS+ Report
</select>

</form>

</td>

</tr>

</table>

</body>

</html>



The bottom frame starts out with basically nothing in it since it's going to be replaced with the page the user selects.

Can anyone figure out why the url of the selection isn't passed to the bottom frame's href property?

Thanks, Dan

qsaaiman is not online. Last active: 5/30/2006 4:23:08 AM qsaaiman
Top 25 Poster
Joined: 28 Jul 2004
Total Posts: 21
 
Re:
Posted: 03 Jul 2002 01:27 AM
Hey.

This should solve your problem:

<script language="Javascript">
function goToURL(form) {
var sel_box_name = window.event.srcElement.name
var selectedItem = form[sel_box_name].selectedIndex
if (!selectedItem == "")
{
window.parent.bottom.location = form[sel_box_name].options[selectedItem].value
}
}
</script>

There was one error. You left out the last "}". :)
Just replace your script with the one above. Just rename your select boxes. Each must have a unique name. Well that's all really. :)

HTH


Quintin Saaiman
Department of Labour
IT Systems

Quintin Saaiman
Previous Thread :: Next Thread 
Page 1 of 1
 
Jsmadeeasy.com  > JS Made Easy  > JavaScript programming  > Using Frames with combo boxes?