Click to See Complete Forum and Search --> : Can someone help me .......


Tasmanian Devil
06-08-2003, 08:06 AM
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

Tasmanian Devil
06-08-2003, 08:27 AM
Originally posted by Dave Clark
Forget cross-browser -- it doesn't work in even one browser as it is. Turn on error reporting in your browser and let's discuss your bugs first.

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

Tasmanian Devil
06-08-2003, 08:39 AM
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

Tasmanian Devil
06-08-2003, 09:09 AM
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.
Test Page ( 216.104.190.167/1test.html)

Thanks for you help Dave

Tasmanian Devil
06-08-2003, 10:17 AM
Dave~
Can you take a look at Test Page (216.104.190.167/1test.html) 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

BrainDonor
06-08-2003, 11:34 AM
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. :D

Tom

Tasmanian Devil
06-08-2003, 12:32 PM
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

Tasmanian Devil
06-08-2003, 01:48 PM
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

Tasmanian Devil
06-08-2003, 02:39 PM
Dave~
I did what you said, but I get a error message saying 'control' is undefined.
take a look at the page Test Page (216.104.190.167/1test.html) and tell me what the heck I am doing wrong. I do apprecate your help on this one Dave.
Thanks

Tasmanian Devil
06-08-2003, 03:21 PM
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

Tasmanian Devil
06-08-2003, 04:11 PM
Dave~
I made the change check out the page at Test Page (http://216.104.190.167/1test.html) and tell me why it is not working netscape?
Thanks

Tasmanian Devil
06-08-2003, 04:36 PM
Dave~
Thank you for your help. I just need the button added also so it goes on different pages depending on opions.
Thanks

Tasmanian Devil
06-08-2003, 05:09 PM
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? Test Page (216.104.190.167/1test.html)
Thanks again for your help

Tasmanian Devil
06-08-2003, 07:04 PM
Dave~
So this looks better Test Page (216.104.190.167/1test.html)?
Thanks again

P.S. when we get this worked out, I still need the button, ok Dave

Tasmanian Devil
06-08-2003, 08:13 PM
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

Tasmanian Devil
06-09-2003, 08:17 AM
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

Tasmanian Devil
06-09-2003, 11:38 AM
Dave~
You out there any where Dave?

Tasmanian Devil
06-09-2003, 09:15 PM
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

Tasmanian Devil
06-09-2003, 09:34 PM
Dave~
So something like Test Page (216.104.190.167/1test.html)? I hope that is right so far.
Thanks

Tasmanian Devil
06-10-2003, 08:27 AM
Dave~
So something like Test Page (216.104.190.167/1test.html)? I hope that is right so far. I do have error reporting on but thought I might look dumb if I said something.
Thanks

Tasmanian Devil
06-10-2003, 04:12 PM
Dave~
Is the above post ok so far?
Thanks

Tasmanian Devil
06-11-2003, 08:37 AM
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

Tasmanian Devil
06-11-2003, 09:58 AM
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

Tasmanian Devil
06-11-2003, 11:38 AM
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

Tasmanian Devil
06-11-2003, 11:41 AM
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

Tasmanian Devil
06-11-2003, 06:21 PM
Dave~
First thing is when you go to the Test Page (216.104.190.167/1test.html), 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

Tasmanian Devil
06-11-2003, 07:29 PM
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

Tasmanian Devil
06-12-2003, 08:50 AM
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

Tasmanian Devil
06-12-2003, 06:06 PM
Dave~
I do not know what is wrong, can you help? Take a look at this Test Page (http://216.104.190.167/1test.html).
Thanks

Tasmanian Devil
06-12-2003, 06:27 PM
Dave~
Ok what the heck am I doing wrong?
Thanks

Tasmanian Devil
06-12-2003, 06:37 PM
Dave~
Ok how about that? I am sorry about that.
Thanks

Tasmanian Devil
06-12-2003, 06:47 PM
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

Tasmanian Devil
06-12-2003, 07:04 PM
Dave~
ohhhhhh ok, how about this now? I think I messed something up
Thanks

Tasmanian Devil
06-13-2003, 07:36 AM
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

Tasmanian Devil
06-13-2003, 02:16 PM
Dave~
If you dont understand just tell me
Thanks

Tasmanian Devil
06-14-2003, 08:25 AM
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

Tasmanian Devil
06-15-2003, 09:10 AM
Dave~
What did I do wrong on my page? (http://216.104.190.167/1test.html)
Thanks

Tasmanian Devil
06-15-2003, 04:54 PM
Dave~
Thanks for your help. I must be one heck of an idiot.
Thanks again Dave
Devil