Click to See Complete Forum and Search --> : jumpMenu and frames targeting


David Robins
04-21-2003, 09:03 AM
I am trying to set up a standard MM_jumpMenu in the top frame of a frameset and want the menu selections to appear
in the 'MAIN' or bottom window of the frameset. I can use
self and parent target names , but when I replace them with
'MAIN' , I get error 'MAIN' not defined .
Main is defined in the frameset page , but the top window
containing the javascript , obviously cant see it ,
I know the answer must be simple but I cant work it out.

script below , Thanks.

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


<FONT face="Arial, Helvetica, sans-serif" size=1>
<SELECT onchange="MM_jumpMenu('self',this,0)" name=menu1>
<OPTION value=01.htm>menu item 1</OPTION>
<OPTION value=02.htm>menu item 2</OPTION>
----------menu options continued etc---------
</SELECT>

gil davis
04-21-2003, 11:57 AM
Try usingMM_jumpMenu('window.top.MAIN',this,0)

David Robins
04-22-2003, 06:23 PM
Thanks Gil,

That works wonderfully. I had to clean up my frameset a bit
to help it work properly.

interestingly I found a security problem with the script
when I had the first line of options inserted as follows
<option selected>---select---</option>
as existed in the original script.
Offline anyway when selected, it displays the entire contents of the subdirectory it resides in , which may not occur when
the page has been uploaded to the server, but I have
removed this line anyway as it adds little value
to the selection panel.

Thanks Again.

gil davis
04-23-2003, 05:37 AM
I have removed this line anyway as it adds little value to the selection panel.I disagree. With a dummy line as the first option, your user will have to make some sort of selection which will trigger the onchange event. Otherwise, the user will never be able to get the first option to navigate. What you have to do is filter the action by ingnoring the selection if the selectedIndex is less than or equal to 0.function MM_jumpMenu(targ,selObj,restore){
if(selObj.selectedIndex > 0) {
// the rest of the functionThe other way around it would be to give the user a "go" button that has an onclick handler to navigate to the selected page. Of course, you should still validate the select object's selectedIndex. Some browsers report selectedIndex = -1 when no option is selected.