View Full Version : triple menu in new window...

06-24-2004, 05:23 PM
hey java community,

thank you for publishing the great triple menu scipt. I really like it! is there any possibiliy for a java beginner to modify it that the final links open in new windows??

thanx for your help

Roy Sinclair
06-24-2004, 05:51 PM
What menu? I don't see a link to anything and you didn't post any code. I suppose I could search for it but as the producer of the question I think it behooves you to provide the necessary information.

FWIW, I'm certain that what you want it to do is quite possible.

06-25-2004, 06:06 AM
And I assume you mean Javascript not Java.

06-25-2004, 08:47 AM
yes, of course java script...

here s the link:::::


06-25-2004, 08:51 AM
sorry for being so clamsy, but it was my first day ....

and the script::::::

<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
<tr align="center">
<td nowrap height="11"> &nbsp;

<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>Webmaster Sites</option>
<option>News Sites</option>

<select name="stage2" size="1" onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select2--------------</option>
<option value=" " selected>---Select2--------------</option>

<select name="stage3" size="1" onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>


Triple Combo Script Credit
By Hamid Cheheltani/ JavaScript Kit (http://www.javascriptkit.com)
Visit http://javascriptkit.com for this and over 400+ other scripts

var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("---Select2---"," ");

group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("JavaScript","47");
group[1][2]=new Option("DHTML","46");
group[1][3]=new Option("CGI","45");

group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("General News","115");
group[2][2]=new Option("Technology News","116");

var temp=document.isc.stage2

function redirect(x){
for (m=temp.options.length-1;m>0;m--)
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)

var secondGroups=document.isc.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++) {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++) {
secondGroup[i][j]=new Array() }}

secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select This One"," ");
secondGroup[1][1][1]=new Option("JavaScript Kit","http://javascriptkit.com");
secondGroup[1][1][2]=new Option("JavaScript for the non programmer","http://webteacher.com/javascript/");
secondGroup[1][1][3]=new Option("Java-Scripts.net","http://java-scripts.net");

secondGroup[1][2][0]=new Option("Now Select This One"," ");
secondGroup[1][2][1]=new Option("Dynamic Drive","http://www.dynamicdrive.com");
secondGroup[1][2][2]=new Option("Beginner\'s Guide to DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/");
secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/");

secondGroup[1][3][0]=new Option("Now Select This One"," ");
secondGroup[1][3][1]=new Option("CGI Resources","http://www.cgi-resources.com");
secondGroup[1][3][2]=new Option("Ada\'s Intro to CGI","http://adashimar.hypermart.net/");

secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select This One"," ");
secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com");
secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com");
secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com");

secondGroup[2][2][0]=new Option("Now Select A Page"," ");
secondGroup[2][2][1]=new Option("News.com","http://www.news.com");
secondGroup[2][2][2]=new Option("Wired","http://www.wired.com");

var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
for (i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)

function redirect2(z){



<p><font face="arial" size="-2">This free script provided by</font><br>
<font face="arial, helvetica" size="-2"><a href="http://javascriptkit.com">JavaScript
Kit</a></font></p> ;) ;) ;)

06-25-2004, 09:18 AM
Change this:

function redirect2(z){


function redirect2(z){
window.open(temp1[z].value, "_blank");

That will open the item in a new window always even after the new window is already opened.

If you only want one new window, change it to:

function redirect2(z){
var w = window.open(temp1[z].value, "mywin");

06-25-2004, 05:53 PM
it really works fine. :thumbsup: :thumbsup: :thumbsup:
would it be possible to set window parameters like *width, height, scrollbar...* in this content??


Willy Duitt
06-25-2004, 06:00 PM

window.open(temp1[z].value, "_blank", "height=400,width=500, scrollbars=no");


06-25-2004, 08:30 PM

I'm trying to create this type triggering cascading menus in a student project using the ArcIMS map software. You can see what I've able to manage at http://mithra.uwaterloo.ca/website/s04/474/ozelayao/Assignment2/mapviewer.htm. Click on the "Search tool" and you'll see two drop down boxes. Below is the code autogenerated by the software. I commented out a change I made. Please notice that in line 48 there's a <form action="" name="theStoreQueryForm"...> which I think is the "FORM" (?). Also notice that the "select name=theStyle" creates the first drop down box. But the actual name is stored/defined in a separate .XLM file (map.axl).

I guess my question is how to modify this code in order to (1) the first box will allow you to select a map layer; (2) the second box will list the name of the query set up for that selected layer; (3) the third box will list the options/criteria set up for the chosen query. I'll appreciate your help.


//The code//
<script language="javascript">
var t_sq;
var t2_sq = "";
if (opener) {
t_sq = opener.parent.MapFrame;
t2_sq = "opener.parent.MapFrame";
} else {
t_sq = parent.MapFrame;
t2_sq = "parent.MapFrame";

function setStyle() {
var f = document.forms[0];
var theCount = t_sq.storedQueryIndex;
var okValue = 0;
if (t_sq.storedQueryVarCount[theCount]==1) {
var theValue = f.theStyle.value;
if (theValue!="") okValue = 1;
} else {
var theValue = f.theStyle[0].value;
if (f.theStyle[0].value!="") okValue = 1;
for (var i=1;i<t_sq.storedQueryVarCount[theCount];i++) {
theValue = theValue + "|" + f.theStyle[i].value;
if (f.theStyle[i].value!="") okValue += 1;
if (okValue==t_sq.storedQueryVarCount[theCount]) {
} else {
alert("Please enter appropriate value");
function selectQuery() {
var f = document.forms[0];
var theIndex = f.theQuery.selectedIndex;

document.writeln('<body bgcolor="Gray" text="Black" topmargin=0 leftmargin=0 rightmargin=0 onload="window.focus()">');
document.writeln('<div align="center">');
document.writeln('<font face="Arial" size="-2"><b>');
document.writeln('<form action="" name="theStoreQueryForm" onsubmit="setStyle(); return false;">');
document.writeln('<table cellspacing="2" nowrap bgcolor="' + t_sq.textFrameFormColor + '" width=100%>');
document.writeln('<tr><th colspan="3" align="CENTER">');
document.writeln('<font face="Arial" size="-1"><b>' + t_sq.msgList[78] + '</b><br></font>');
document.writeln('<font face="Arial" size="-2"><b>' + t_sq.msgList[79] + '</b></font>');
document.writeln('<td align="Left">');
document.writeln('<font face="Arial" size="-1">' + t_sq.LayerName[t_sq.ActiveLayerIndex]);
document.writeln('<select name="theQuery" onchange="selectQuery()">')
for (var i=0;i<t_sq.storedQueryCount;i++) {
document.write(' <option value=' + i);
if (i==t_sq.storedQueryIndex) document.write(' selected');
document.writeln('>' + t_sq.storedQueryName[i]);

document.writeln('<td align="RIGHT"><font face="Arial" size="-1">');
for (var i=0;i<t_sq.storedQueryVarCount[t_sq.storedQueryIndex];i++) {
if (t_sq.storedQueryVarCount[t_sq.storedQueryIndex]>1) document.write(' ' + (i+1));


//document.writeln('<input type=text name="theStyle" value=""><br>');

//changed to create the 2 drop down boxes
document.writeln('<select name="theStyle">');
document.writeln('<option value="=-1">Above Water Table</option>');
document.writeln('<option value=">=0">Below Water Table</option>');

document.writeln('<td align="CENTER">');
document.writeln('<input type="Button" name="setDU" value="' + t_sq.buttonList[6] + '" onclick="setStyle()"> <br>');


10-11-2004, 02:03 PM
would it be also possible to add a forth point to this script?

thanx for all of your replies
greets :thumbsup: