pinkotoad
07-30-2002, 05:21 PM
Hi, I'm trying to make a script that will take the index of a drop down box and subtract it from the selectedIndex. This is how I am trying to do it:
var Xvalue = new Array(6)
Xvalue[0] = 75
Xvalue[1] = 100
Xvalue[2] = 120
Xvalue[3] = 140
Xvalue[4] = 180
Xvalue[5] = 215
var X = Xvalue[form.X.selectedIndex]
function AddTotal() {
Xadd = (Xvalue[form.X.Index]) - X)
}
Then I use this to write it to the document:
document.write(AddTotal(CPUadd))
The problems I am having are:
1. It keeps telling me that ";" was expected in strange places, where I haven't even touched since I tried implement this.
2. 'CPUadd' is undefined.
3. It tells me that there was an object expected in the <BODY> tag.
var Xvalue = new Array(6)
Xvalue[0] = 75
Xvalue[1] = 100
Xvalue[2] = 120
Xvalue[3] = 140
Xvalue[4] = 180
Xvalue[5] = 215
var X = Xvalue[form.X.selectedIndex]
function AddTotal() {
Xadd = (Xvalue[form.X.Index]) - X)
}
Then I use this to write it to the document:
document.write(AddTotal(CPUadd))
The problems I am having are:
1. It keeps telling me that ";" was expected in strange places, where I haven't even touched since I tried implement this.
2. 'CPUadd' is undefined.
3. It tells me that there was an object expected in the <BODY> tag.