/    Sign up×
Community /Pin to ProfileBookmark

Can someone help me …….

Can someone help me make this script cross bowser? I do not know how to. Code is as follows:
<HEAD>
<SCRIPT LANGUAGE=”JavaScript”>
var arrItems1 = new Array();
var arrItemsGrp1 = new Array();

arrItems1[3] = “Truck”;
arrItemsGrp1[3] = 1;
arrItems1[4] = “Train”;
arrItemsGrp1[4] = 1;
arrItems1[5] = “Car”;
arrItemsGrp1[5] = 1;

arrItems1[6] = “Boat”;
arrItemsGrp1[6] = 2;
arrItems1[7] = “Submarine”;
arrItemsGrp1[7] = 2;

arrItems1[0] = “Planes”;
arrItemsGrp1[0] = 3;
arrItems1[1] = “Ultralight”;
arrItemsGrp1[1] = 3;
arrItems1[2] = “Glider”;
arrItemsGrp1[2] = 3;

var arrItems2 = new Array();
var arrItemsGrp2 = new Array();

arrItems2[21] = “747”;
arrItemsGrp2[21] = 0
arrItems2[22] = “Cessna”;
arrItemsGrp2[22] = 0

arrItems2[31] = “Kolb Flyer”;
arrItemsGrp2[31] = 1
arrItems2[34] = “Kitfox”;
arrItemsGrp2[34] = 1

arrItems2[35] = “Schwietzer Glider”;
arrItemsGrp2[35] = 2

arrItems2[99] = “Chevy Malibu”;
arrItemsGrp2[99] = 5
arrItems2[100] = “Lincoln LS”;
arrItemsGrp2[100] = 5
arrItems2[57] = “BMW Z3”;
arrItemsGrp2[57] = 5

arrItems2[101] = “F-150”;
arrItemsGrp2[101] = 3
arrItems2[102] = “Tahoe”;
arrItemsGrp2[102] = 3

arrItems2[103] = “Freight Train”;
arrItemsGrp2[103] = 4
arrItems2[104] = “Passenger Train”;
arrItemsGrp2[104] = 4

arrItems2[105] = “Oil Tanker”;
arrItemsGrp2[105] = 6
arrItems2[106] = “Fishing Boat”;
arrItemsGrp2[106] = 6

arrItems2[200] = “Los Angelas Class”;
arrItemsGrp2[200] = 7
arrItems2[201] = “Kilo Class”;
arrItemsGrp2[201] = 7
arrItems2[203] = “Seawolf Class”;
arrItemsGrp2[203] = 7

function selectChange(control, controlToPopulate, ItemArray, GroupArray)
{
var myEle ;
var x ;
for (var q=controlToPopulate.options.length;q>=0;q–) controlToPopulate.options[q]=null;
if (control.name == “firstChoice”) {

for (var q=myChoices.thirdChoice.options.length;q>=0;q–) myChoices.thirdChoice.options[q] = null;

}
myEle = document.createElement(“option”) ;
myEle.value = 0 ;
myEle.text = “[SELECT]” ;
controlToPopulate.add(myEle) ;
for ( x = 0 ; x < ItemArray.length ; x++ )
{
if ( GroupArray[x] == control.value )
{
myEle = document.createElement(“option”) ;
myEle.value = x ;
myEle.text = ItemArray[x] ;
controlToPopulate.add(myEle) ;
}
}
}
// End –>
</script>

<BODY>
<form name=test>
<table align=”center”>
<tr>
<td>
<SELECT id=firstChoice name=firstChoice onchange=”selectChange(this, myChoices.secondChoice, arrItems1, arrItemsGrp1);”>
<option value=0 SELECTED>[SELECT]</option>
<option value=1>Land</option>
<option value=2>Sea</option>
<option value=3>Air</option>
</SELECT>
</TD><TD>
<SELECT id=secondChoice name=secondChoice onchange=”selectChange(this, myChoices.thirdChoice, arrItems2, arrItemsGrp2);”>
</SELECT>
<SELECT id=thirdChoice name=thirdChoice>
</SELECT>
</TD>
</TR>
</TABLE>
</form>

Thanks for your help

to post a comment
JavaScript

37 Comments(s)

Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — [i]Originally posted by Dave Clark [/i]

[B]Forget cross-browser -- it doesn't work in even [b][u][i]one[/i][/u][/b] browser as it is. Turn on error reporting in your browser and let's discuss your bugs first.[/B][/QUOTE]


Dave~

It works in the IE 6.0 and it netscape, it gives me the first oppion but when selected, I can not receive the other opttions.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

Sorry about that, I worked out the bugs in IE6 code is as follows:

<html>

<head>

<title>Untitled Document</title>

<SCRIPT LANGUAGE="JavaScript">

var arrItems1 = new Array();

var arrItemsGrp1 = new Array();

arrItems1[3] = "Truck";

arrItemsGrp1[3] = 1;

arrItems1[4] = "Train";

arrItemsGrp1[4] = 1;

arrItems1[5] = "Car";

arrItemsGrp1[5] = 1;

arrItems1[6] = "Boat";

arrItemsGrp1[6] = 2;

arrItems1[7] = "Submarine";

arrItemsGrp1[7] = 2;

arrItems1[0] = "Planes";

arrItemsGrp1[0] = 3;

arrItems1[1] = "Ultralight";

arrItemsGrp1[1] = 3;

arrItems1[2] = "Glider";

arrItemsGrp1[2] = 3;

var arrItems2 = new Array();

var arrItemsGrp2 = new Array();

arrItems2[21] = "747";

arrItemsGrp2[21] = 0

arrItems2[22] = "Cessna";

arrItemsGrp2[22] = 0

arrItems2[31] = "Kolb Flyer";

arrItemsGrp2[31] = 1

arrItems2[34] = "Kitfox";

arrItemsGrp2[34] = 1

arrItems2[35] = "Schwietzer Glider";

arrItemsGrp2[35] = 2

arrItems2[99] = "Chevy Malibu";

arrItemsGrp2[99] = 5

arrItems2[100] = "Lincoln LS";

arrItemsGrp2[100] = 5

arrItems2[57] = "BMW Z3";

arrItemsGrp2[57] = 5

arrItems2[101] = "F-150";

arrItemsGrp2[101] = 3

arrItems2[102] = "Tahoe";

arrItemsGrp2[102] = 3

arrItems2[103] = "Freight Train";

arrItemsGrp2[103] = 4

arrItems2[104] = "Passenger Train";

arrItemsGrp2[104] = 4

arrItems2[105] = "Oil Tanker";

arrItemsGrp2[105] = 6

arrItems2[106] = "Fishing Boat";

arrItemsGrp2[106] = 6

arrItems2[200] = "Los Angelas Class";

arrItemsGrp2[200] = 7

arrItems2[201] = "Kilo Class";

arrItemsGrp2[201] = 7

arrItems2[203] = "Seawolf Class";

arrItemsGrp2[203] = 7

function selectChange(control, controlToPopulate, ItemArray, GroupArray)

{

var myEle ;

var x ;

for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;

if (control.name == "firstChoice") {

for (var q=test.thirdChoice.options.length;q>=0;q--) test.thirdChoice.options[q] = null;

}

myEle = document.createElement("option") ;

myEle.value = 0 ;

myEle.text = "[SELECT]" ;

controlToPopulate.add(myEle) ;

for ( x = 0 ; x < ItemArray.length ; x++ )

{

if ( GroupArray[x] == control.value )

{

myEle = document.createElement("option") ;

myEle.value = x ;

myEle.text = ItemArray[x] ;

controlToPopulate.add(myEle) ;

}

}

}

</script>

</head>

<body bgcolor="#FFFFFF" text="#000000">

<form name=test>

<table align="center">

<tr>

<td>

<SELECT id=firstChoice name=firstChoice onchange="selectChange(this, test.secondChoice, arrItems1, arrItemsGrp1);">

<option value=0 SELECTED>[SELECT]</option>

<option value=1>Land</option>

<option value=2>Sea</option>

<option value=3>Air</option>

</SELECT>

</TD><TD>

<SELECT id=secondChoice name=secondChoice onchange="selectChange(this, test.thirdChoice, arrItems2, arrItemsGrp2);">

</SELECT>

<SELECT id=thirdChoice name=thirdChoice>

</SELECT>

</TD>

</TR>

</TABLE>

</form>

</body>

</html>

Not sure on netscape

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

Have two things for you, 1) it still does not work in netscape. 2) how do I add a button, when pressed it will go to a different page?

Here is a link to a test page for you to see.

[URL= 216.104.190.167/1test.html]Test Page[/URL]

Thanks for you help Dave
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

Can you take a look at [URL=216.104.190.167/1test.html]Test Page[/URL] again and tell me what the heck I am doing wrong? As well at the button issue? I messed something up and not sure what it is.

Thanks
Copy linkTweet thisAlerts:
@BrainDonorJun 08.2003 — I've messed with this a little, using Dave's changes...the first one works fine...something wrong with the updated code though I think.

Here's all the code with Dave's first fix added in...I didn't test this in Netscape because I don't use it. ?

<html>

<head>

<title>Untitled Document</title>

<SCRIPT LANGUAGE="JavaScript">

var arrItems1 = new Array();

var arrItemsGrp1 = new Array();

arrItems1[3] = "Truck";

arrItemsGrp1[3] = 1;

arrItems1[4] = "Train";

arrItemsGrp1[4] = 1;

arrItems1[5] = "Car";

arrItemsGrp1[5] = 1;

arrItems1[6] = "Boat";

arrItemsGrp1[6] = 2;

arrItems1[7] = "Submarine";

arrItemsGrp1[7] = 2;

arrItems1[0] = "Planes";

arrItemsGrp1[0] = 3;

arrItems1[1] = "Ultralight";

arrItemsGrp1[1] = 3;

arrItems1[2] = "Glider";

arrItemsGrp1[2] = 3;

var arrItems2 = new Array();

var arrItemsGrp2 = new Array();

arrItems2[21] = "747";

arrItemsGrp2[21] = 0

arrItems2[22] = "Cessna";

arrItemsGrp2[22] = 0

arrItems2[31] = "Kolb Flyer";

arrItemsGrp2[31] = 1

arrItems2[34] = "Kitfox";

arrItemsGrp2[34] = 1

arrItems2[35] = "Schwietzer Glider";

arrItemsGrp2[35] = 2

arrItems2[99] = "Chevy Malibu";

arrItemsGrp2[99] = 5

arrItems2[100] = "Lincoln LS";

arrItemsGrp2[100] = 5

arrItems2[57] = "BMW Z3";

arrItemsGrp2[57] = 5

arrItems2[101] = "F-150";

arrItemsGrp2[101] = 3

arrItems2[102] = "Tahoe";

arrItemsGrp2[102] = 3

arrItems2[103] = "Freight Train";

arrItemsGrp2[103] = 4

arrItems2[104] = "Passenger Train";

arrItemsGrp2[104] = 4

arrItems2[105] = "Oil Tanker";

arrItemsGrp2[105] = 6

arrItems2[106] = "Fishing Boat";

arrItemsGrp2[106] = 6

arrItems2[200] = "Los Angelas Class";

arrItemsGrp2[200] = 7

arrItems2[201] = "Kilo Class";

arrItemsGrp2[201] = 7

arrItems2[203] = "Seawolf Class";

arrItemsGrp2[203] = 7

function selectChange(control, controlToPopulate, ItemArray, GroupArray)

{

for (var q=controlToPopulate.options.length;q>=0;q--) controlToPopulate.options[q]=null;

if (control.name == "firstChoice") {

for (var q=test.thirdChoice.options.length;q>=0;q--) test.thirdChoice.options[q] = null;

}

controlToPopulate.options[0] = new Option("[SELECT]");

for (var x = 0 ; x < ItemArray.length ; x++ )

{

if ( GroupArray[x] == control.value )

{

controlToPopulate.options[controlToPopulate.length] = new Option(ItemArray[x], x);

}

}

}

</script>

</head>

<body bgcolor="#FFFFFF" text="#000000">

<form name=test>

<table align="center">

<tr>

<td>

<SELECT id=firstChoice name=firstChoice onchange="selectChange(this, test.secondChoice,

arrItems1, arrItemsGrp1);">

<option value=0 SELECTED>[SELECT]</option>

<option value=1>Land</option>

<option value=2>Sea</option>

<option value=3>Air</option>

</SELECT>

</TD><TD>

<SELECT id=secondChoice name=secondChoice onchange="selectChange(this, test.thirdChoice,

arrItems2, arrItemsGrp2);">

</SELECT>

<SELECT id=thirdChoice name=thirdChoice>

</SELECT>

</TD>

</TR>

</TABLE>

</form>

</body>

</html>

Please keep in mind I have no idea what I'm doing. Just trying to help. ?

Tom
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Tom~

That did work, just will not work in netscape. Thank you.

Dave~

Now that I have it to work, how can we make it cross browser? as well as add a button, for when click it goes to a page based on the selections?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

Sorry to be dumb at this but not sure what you mean with earlier post. Can you explain a little better for me?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

I did what you said, but I get a error message saying 'control' is undefined.

take a look at the page [URL=216.104.190.167/1test.html]Test Page[/URL] and tell me what the heck I am doing wrong. I do apprecate your help on this one Dave.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

It works in IE6 but not in netscape, why not? plus if you can help me add that button, for when pressed, it will go to different pages based on options.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

I made the change check out the page at [URL=http://216.104.190.167/1test.html]Test Page[/URL] and tell me why it is not working netscape?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

Thank you for your help. I just need the button added also so it goes on different pages depending on opions.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 08.2003 — Dave~

I am sorry, I am not good at these things and appreceate that your taking the time to work it out with me. Is this better now? [URL=216.104.190.167/1test.html]Test Page[/URL]

Thanks again for your help
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 09.2003 — Dave~

So this looks better [URL=216.104.190.167/1test.html]Test Page[/URL]?

Thanks again

P.S. when we get this worked out, I still need the button, ok Dave
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 09.2003 — Dave~

I would like the button press after all three choices are pick that it goes to a page, primarely based on the third choice. can the button be blocked untill the third choice is picked?

Thanks again
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 09.2003 — Dave~

When the third choice is picked and the button is pressed, it will take the user to different urls. Each choice has a different url though.

Thanks Again
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 09.2003 — Dave~

You out there any where Dave?
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 10.2003 — Dave~

The problem is, I do not know how to go about it. I could try if I knew what I was doing, but I have no clue what or how to do it.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 10.2003 — Dave~

So something like [URL=216.104.190.167/1test.html]Test Page[/URL]? I hope that is right so far.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 10.2003 — Dave~

So something like [URL=216.104.190.167/1test.html]Test Page[/URL]? I hope that is right so far. I do have error reporting on but thought I might look dumb if I said something.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 10.2003 — Dave~

Is the above post ok so far?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 11.2003 — Dave~

Thank yo uo much for your help there are only two things left that I would like to know/need help with. 1) if for some odd reason I need to add any other pulldown menu, just modify it to similar what is already there? 2) before you pick a selection in the first, when you click the second or third, you see a outline of a list, can you hide it so you do not see the outline?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 11.2003 — Dave~

I do not know what I did, but I do not get errors but I can not get the last options to come up. Can you help.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 11.2003 — Dave~

Sorry about that, I did get the last opion to come up now. I just now need help on the outline not to show up. And if I want to add, I do not understand how to do it.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 11.2003 — Dave~

One other thing, I am able to change teh first option where it says select but how do I do the second and third? I was able to change the second but I want it to says something different than the third one.

Thanks

P.S. So to be such a pain in the but, but I want to learn and your a good teacher
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 11.2003 — Dave~

First thing is when you go to the [URL=216.104.190.167/1test.html]Test Page[/URL], I started to modify it to what I need. But when you open the page and without clicking on anything, and click on the second or third option, there is a outline that drops down from the pulldown menu, can we eleminate that?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

That is no big deal I guess, the 2 of 3 I had for you is, if you look at the second option. I wanted to add the rest of the week like I had started, but if I use the number 6 that would interfer with other options (the lines right below where I started the week)

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

Is this right so far? Not sure what I need to change but got a feeling that it deals with the error that I am getting: arrltems1 is undefined, is that correct and what needs to be fixed?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

I do not know what is wrong, can you help? Take a look at this [URL=http://216.104.190.167/1test.html]Test Page[/URL].

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

Ok what the heck am I doing wrong?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

Ok how about that? I am sorry about that.

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 12.2003 — Dave~

How is that? I am not getting the third option to show up now, when appleton and then sunday selected, you should get F-150 for the third

Thanks

P.S. There will be only one more thing I would like help on
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 13.2003 — Dave~

ohhhhhh ok, how about this now? I think I messed something up

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 13.2003 — Dave~

Thank you so much for your help, Just one more thing if you do not mind. I need where it says [SELECT] for the second option to say [Day of the week] and the third option to say [Color]. Can that be done?

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 13.2003 — Dave~

If you dont understand just tell me

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 14.2003 — Dave~

Thanks for your help so much, If needed I know I can count on you. Sorry for being so many posts and being a pain in the but.

Thanks again

Devil
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 15.2003 — Dave~

What did I do wrong on my [URL=http://216.104.190.167/1test.html]page?[/URL]

Thanks
Copy linkTweet thisAlerts:
@Tasmanian_DevilauthorJun 15.2003 — Dave~

Thanks for your help. I must be one heck of an idiot.

Thanks again Dave

Devil
×

Success!

Help @Tasmanian_Devil 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 5.28,
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: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

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

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...