Welcome to WebmasterWorld Guest from 184.73.3.107

Forum Moderators: open

javascript problem

   
11:05 pm on Jun 9, 2002 (gmt 0)

10+ Year Member



I am trying to use a jumpmenu which is located in a sideframe, to submit the value of the selected option using POST to a Java Server Page - Store.jsp. This should then open in the main frame in the middle, however I don't know how to open the jsp in the middle frame, it keeps on opening in the side frame which should remain the same.

any help appreciated.

my snippets of code look like this:

// here is the function which should open
// store.jsp in the main frame.

function jumpPage(form) {

var i = form.SelectMenu.selectedIndex;
if (i == 0) return;

form.submit(); // this currently opens
// Store.jsp
// in the side frame, which is
// incorrect.

}

....

<FORM Name="selectionForm" ACTION="Store.jsp" METHOD=POST >

....

<SCRIPT>
function MakeArray()
{
this.length = MakeArray.arguments.length
for (var i = 0; i < this.length; i++)
this[i+1] = MakeArray.arguments[i]
}

var siteopt = new MakeArray("Roland",
"Novation",
"Korg",
"Nord",
"Clavia",
"Access");

var url = new MakeArray("",
"Store.jsp",
"Store.jsp",
"Store.jsp",
"Store.jsp",
"Store.jsp");

document.writeln('<FORM><SELECT NAME="SelectMenu" onChange="jumpPage(this.form)">');
tot = siteopt.length;
for (var i = 1; i <= tot; i++)
document.write("<OPTION>" +siteopt[i]);
document.writeln('</SELECT>');
document.writeln('</FORM>');

</SCRIPT>

11:25 pm on Jun 9, 2002 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello christogray,

Welcome to Webmaster World!
How are you building your <select><option> menu? And how are you targeting the frame?

12:10 am on Jun 10, 2002 (gmt 0)

10+ Year Member



Thanks for the reply,

This part creates the select option dropdown menu

<SCRIPT>
function MakeArray()
{
this.length = MakeArray.arguments.length
for (var i = 0; i < this.length; i++)
this[i+1] = MakeArray.arguments[i]
}

var siteopt = new MakeArray("Roland",
"Novation",
"Korg",
"Nord",
"Clavia",
"Access");

var url = new MakeArray("", //this url array is
//not actually needed.
"Store.jsp",
"Store.jsp",
"Store.jsp",
"Store.jsp",
"Store.jsp");

document.writeln('<FORM><SELECT NAME="SelectMenu" onChange="jumpPage(this.form)">');
tot = siteopt.length;
for (var i = 1; i <= tot; i++)
document.write("<OPTION>" +siteopt[i]);
document.writeln('</SELECT>');
document.writeln('</FORM>');

</SCRIPT>


I do not know how to target the middle frame with the form.submit(), this is what I'd like to do.
Say the middle frame is called middle.htm, how do I get the jsp page to appear in this when the user selects an option

I'm quite new to javascript programming and have done my website development using sample code for the most part.

again, any help appreciated.

11:28 am on Jun 10, 2002 (gmt 0)

10+ Year Member



I suggest trying a target attribute in the <form> element, just like you would use it for an <a> element.

No guarantees, though -- I've never tried it myself.

 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month