/    Sign up×
Community /Pin to ProfileBookmark

‘divide menu’ compatible with only Internet Explorer

Could somebody please tell me why this Javascript menu dividing 2 separate selection boxes; is working with Internet Explorer but not with Netscape or any Apple Macintosh Browser (including Internet Explorer), Javascript is enabled in all browsers:
<head>
<script language=”javascript”>
<!–
// define global arrays for child select boxes
var aChildListOptions1;
var aChildListOptions2;

function Initialize() {

// retrieve number of options in parent select box
var iParentListOptionsNum = document.forms(‘isc’).elements(‘parentList’).options.length;

// initialize child select boxes
aChildListOptions1 = new Array(iParentListOptionsNum);
aChildListOptions2 = new Array(iParentListOptionsNum);

for (var i = 0; i < iParentListOptionsNum; i++) {

aChildListOptions1[i] = new Array();
aChildListOptions2[i] = new Array();
}

// initialize data needed to populate option list of first child select box
aChildListOptions1[0][0] = new Option(‘Northern Sport Fishing’, ‘http://www.duenorth.net/northernsportfishing’);
aChildListOptions1[0][1] = new Option(‘Mikisew Sportfishing’, ‘http://www.mikisewsportfishing.com/sub1.htm’);
aChildListOptions1[1][0] = new Option(‘Guide of British Columbia’, ‘http://www.guidebc.com/’);
aChildListOptions1[1][1] = new Option(‘Fishing BC’, ‘http://www.fishing.bc.ca/’);
aChildListOptions1[1][2] = new Option(‘North West Fishing Guides’, ‘http://www.northwestfishingguides.com/’);
aChildListOptions2[1][3] = new Option(‘Going Fishing’, ‘http://www.going-fishing.com/’);
aChildListOptions1[2][0] = new Option(‘Travel the Northwest’, ‘http://www.nwttravel.nt.ca/html/list6.htm’);
aChildListOptions1[3][0] = new Option(‘Fishing Yukon’, ‘http://www.fishingyukon.com/’);
aChildListOptions1[3][1] = new Option(‘Yukon Web’, ‘http://www.yukonweb.com/tourism/rendezvous/fish.html’);

// initialize data needed to populate option list of second child select box
aChildListOptions2[0][0] = new Option(‘Margaret Lake Lodge’, ‘http://www.cariboumountain.com/’);
aChildListOptions2[1][0] = new Option(‘Big Spring Resort’, ‘http://www.bigspringresort.com/fishing.php’);
aChildListOptions2[1][1] = new Option(‘Bucks Trophy Lodge’, ‘http://www.buckstrophylodge.com/index.htm’);
aChildListOptions2[1][2] = new Option(‘Campbell River Lodge’, ‘http://www.campbellriverlodge.com/’);
aChildListOptions2[1][3] = new Option(‘Cee Pee Cee Lodge’, ‘http://www.buckstrophylodge.com/index.htm’);
aChildListOptions2[1][4] = new Option(‘Crazy Bear Lodge’, ‘http://www.crazybearlodge.com/’);
aChildListOptions2[1][5] = new Option(‘Damdochak’, ‘http://www.damdochax.com/’);
aChildListOptions2[2][0] = new Option(‘Arctic Fishing’, ‘http://www.arcticfishing.com/trophyfishing.htm’);
aChildListOptions2[2][1] = new Option(‘Aylmer Lake’, ‘http://www.aylmerlake.com/location_1.htm’);
aChildListOptions2[2][2] = new Option(‘Bathurst Inlet Lodge’, ‘http://www.bathurstinletlodge.com/05_fishing.htm’);
aChildListOptions2[2][3] = new Option(‘Blachford Lake Lodge’, ‘http://users.internorth.com/~blach/fishing.htm’);
aChildListOptions2[2][4] = new Option(‘Crazy Bear Lodge’, ‘http://www.crazybearlodge.com/’);
aChildListOptions2[2][5] = new Option(‘Frontier Fishing Lodge’, ‘http://www.frontierfishing.ab.ca/’);
aChildListOptions2[3][0] = new Option(‘Dalton Trail’, ‘http://www.daltontrail.com/fishing.asp’);
aChildListOptions2[3][1] = new Option(‘Inconnu Lodge’, ‘http://www.inconnulodge.com/yfish.htm’);
aChildListOptions2[3][2] = new Option(‘Kluane Lodge’, ‘http://www.kluanelodge.com’);
aChildListOptions2[3][3] = new Option(‘Quantum Linx’, ‘http://www.quantumlinx.com/wolflake/flyfish1.htm’);
aChildListOptions2[3][4] = new Option(‘Taylors Place’, ‘http://www.taylorsplace.ca’);
aChildListOptions2[3][5] = new Option(‘Tincup Lodge’, ‘http://www.tincup.yk.ca/fishing.html’);
}

function PopulateChildLists(oForm) {

// retrieve references to child select boxes
var oChildList1 = oForm.elements(‘childList1’);
var oChildList2 = oForm.elements(‘childList2’);

// retrieve the current selected index of the parent list
var iParentListIndex = oForm.elements(‘parentList’).options.selectedIndex;

// reset option list of first child select box
for (var i = oChildList1.options.length – 1; i >= 0; i–)
oChildList1.options.remove(i);

// reset option list of second child select box
for (var j = oChildList2.options.length – 1; j >= 0; j–)
oChildList2.options.remove(j);

// populate option list of first child select box with new options
for (var k = 0; k < aChildListOptions1[iParentListIndex].length; k++)
oChildList1.options[k] = aChildListOptions1[iParentListIndex][k];

// populate option list of second child select box with new options
for (var l = 0; l < aChildListOptions2[iParentListIndex].length; l++)
oChildList2.options[l] = aChildListOptions2[iParentListIndex][l];
}

function go(oChildList) {

window.open(oChildList.options[oChildList.selectedIndex].value);
}

window.onload = Initialize;
//–>

</head>
<body>
<table border=”0″ cellspacing=”3″ cellpadding=”0″ width=”100%” style=”border-collapse: collapse” bordercolor=”#111111″>
<tr>
<td rowspan=”2″ width=”50%”>
<font size=”2″>Region/State:<BR></font>
<select name=”parentList” size=”5″ onChange=”JavaScript: PopulateChildLists(this.form);”>
<option>Alberta</option>
<option>British Columbia</option>
<option>North West Territories</option>
<option>Yukon</option>
</select>
</td>
<td width=”50%”><font size=”2″>Fishing links: About the Region<BR></font>
<select name=”childList1″ size=”5″ style=”width: 200px”;>
<option>Please</option>
<option>select a</option>
<option>region</option>
</select>
<input type=”button” name=”test” value=”Go!” onClick=”JavaScript: go(this.form.elements(‘childList1’));”>
</td>
</tr>
<tr>
<td width=”50%”><font size=”2″>Special Fishing Accomodations:<BR></font>
<select name=”childList2″ size=”5″ style=”width: 200px”;>
<option>Please</option>
<option>select a</option>
<option>region</option>
</select>
<input type=”button” name=”test” value=”Go!” onClick=”JavaScript: go(this.form.elements(‘childList2’));”></td>
</tr>
</table>
</form>
</body>

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @dehaank spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...