472,780 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,780 software developers and data experts.

select menu and display in the frame

Dear Everybody,

I have a double menu select javascript, could anyone know
how to change it, so that the result will display in a frame
name called "content", please?

Here is the script.
<html><body>
<script>
<!--
v=false;
//-->
</script>
<script>
<!--
if (typeof(Option)+"" != "undefined") v=true;
//-->
</script>
<script>
<!-- Begin
if(v){a=new Array();aln=0;}
function getFormNum (formName) {
formNum =-1;
for (i=0;i<document.forms.length;i++){
tempForm = document.forms[i];
if (formName == tempForm) {
formNum = i;
correctForm = tempForm;
break;
}
}
return formNum;
}
function jmp(formName,elementNum) {
getFormNum(formName);
if (formNum>=0) {
with (document.forms[formNum].elements[elementNum]) {
i=selectedIndex;
if (i>=0) location=options[i].value;
}
}
}
function O(txt,url) {
a[k]=new Option(txt,url);k++;
}
function relate(formName,elementNum,j) {
if(v) {
k=1;
if(j==0) { // default category item
a=new Array();
O("Select day","");
}

if(j==1) { // 1st category items
a=new Array();
O("Select day","");
O("Dec 25","2003/1225.html");
}

if(j==2) { // 2nd category items
a=new Array();
O("Select day","");
O("March 6","2004/0306.html");
}

aln2=a.length;
getFormNum(formName);
if (formNum>=0) {
formNum = formNum + 1;
with (document.forms[formNum].elements[elementNum]) {
for (var i=options.length-1;i>0;i--) options[i]=null;
for (var i=1;i<aln2;i++) options[i-1]=a[i];
options[0].selected=true;
}
}
} else {
jmp(formName,elementNum);
}
}
// End -->
</script>
<center>
<table><tr>
<td align=center valign=bottom>
<form name=f1 method=post action="" onSubmit="return false;">
<select name=m1 onChange="relate(this.form,0,this.selectedIndex);
document.f2.m2.focus();">
<option value="/" class=select>Select Year
<option value="/" class=year>2003
<option value="/" class=year>2004
</select></form></td>
<td align=center valign=bottom>
<form name=f2 method=post action="" onsubmit="return false;">
<select name="m2" onchange="jmp(this.form,0)">
<option value="/" class=selectday>Select day
<option value="/">
</select></form></td>
</tr></table>
</body></html>
--
thank you very much for your help.
Jul 23 '05 #1
1 1926
quick solution...
i would suggest tho' that you think of a neater way to do this.
Don't get me wrong, not saying its bad or wrong, just from what i see there
are shorter and neater ways to do it :0)

Good luck

Change this funcion to create the url and make it the form's ACTION
then submit the form
function jmp(formName,elementNum) {
getFormNum(formName);
if (formNum>=0) {
with (document.forms[formNum].elements[elementNum]) {
i=selectedIndex;
if (i>=0) frmAction=options[i].value;
document.forms[formNum].action = frmAction;
document.forms[formNum].submit();
}
}
}

give the form the target you want, so when it is submitted above, it'll
sumit to that frame

<form name=f2 method=post TARGET="FRAME_NAME" action="" onsubmit="return
false;">
<select name="m2" onchange="jmp(this.form,0)">
<option value="/" class=selectday>Select day
<option value="/">
</select></form>
cheers
"John Fung" <js*****@netvigator.com> wrote in message
news:dc*************************@posting.google.co m...
Dear Everybody,

I have a double menu select javascript, could anyone know
how to change it, so that the result will display in a frame
name called "content", please?

Here is the script.
<html><body>
<script>
<!--
v=false;
//-->
</script>
<script>
<!--
if (typeof(Option)+"" != "undefined") v=true;
//-->
</script>
<script>
<!-- Begin
if(v){a=new Array();aln=0;}
function getFormNum (formName) {
formNum =-1;
for (i=0;i<document.forms.length;i++){
tempForm = document.forms[i];
if (formName == tempForm) {
formNum = i;
correctForm = tempForm;
break;
}
}
return formNum;
}
function jmp(formName,elementNum) {
getFormNum(formName);
if (formNum>=0) {
with (document.forms[formNum].elements[elementNum]) {
i=selectedIndex;
if (i>=0) location=options[i].value;
}
}
}
function O(txt,url) {
a[k]=new Option(txt,url);k++;
}
function relate(formName,elementNum,j) {
if(v) {
k=1;
if(j==0) { // default category item
a=new Array();
O("Select day","");
}

if(j==1) { // 1st category items
a=new Array();
O("Select day","");
O("Dec 25","2003/1225.html");
}

if(j==2) { // 2nd category items
a=new Array();
O("Select day","");
O("March 6","2004/0306.html");
}

aln2=a.length;
getFormNum(formName);
if (formNum>=0) {
formNum = formNum + 1;
with (document.forms[formNum].elements[elementNum]) {
for (var i=options.length-1;i>0;i--) options[i]=null;
for (var i=1;i<aln2;i++) options[i-1]=a[i];
options[0].selected=true;
}
}
} else {
jmp(formName,elementNum);
}
}
// End -->
</script>
<center>
<table><tr>
<td align=center valign=bottom>
<form name=f1 method=post action="" onSubmit="return false;">
<select name=m1 onChange="relate(this.form,0,this.selectedIndex);
document.f2.m2.focus();">
<option value="/" class=select>Select Year
<option value="/" class=year>2003
<option value="/" class=year>2004
</select></form></td>
<td align=center valign=bottom>
<form name=f2 method=post action="" onsubmit="return false;">
<select name="m2" onchange="jmp(this.form,0)">
<option value="/" class=selectday>Select day
<option value="/">
</select></form></td>
</tr></table>
</body></html>
--
thank you very much for your help.

Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Joachim Bauer | last post by:
I'm using the code below to display a menu that opens when the mouse goes over the main menu item (try it in your browser to understand the behaviour). It uses "position:absolute" and a switch...
2
by: jascraig | last post by:
Here's my dilemma. I'm working with a frameset with 3 frames (header,content,control). My control frame contains a select list with buttons for next and previous. When the next button is pushed...
2
by: hemanth.singamsetty | last post by:
Hello there, I've a drop down menu (created using CSS & Javascript -- see code below). My problem is, whenever I click a link on the menu the new page replaces the current page (and the menu...
3
by: Ohad Young | last post by:
Hi, I have a frameset page that contains two frames: 1. the first frame, an aspx page, contains a menu for navigating in the website. 2. the second frame contains content, pdf, html or other...
1
by: server side menu problem2 | last post by:
hi, in my site there r 2 frames: 1.menu frame 2.application display the menu is based on <A HREF=...> because I need to direct the pages to the application display frame.now I need to cuach a...
2
by: fuchsteiner | last post by:
I can't find any support for frames in the asp:menu control. Not the Target frame, but displaying sub-menus across a frame boundary. There are lots of 3rd party Menu tools that do this. I have a...
1
nomad
by: nomad | last post by:
I need help with JcomboBox When and User select the Exit in the File box it will the //inner class class exitListener implements ActionListener { ... } which it open a window asking them if...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.