0

I'm getting the error above from Char 1 of the 4th line... No clue what's throwing it? I'm sure its something simple that I don't see...

out = out + "<b>Select Box Information</b><br><br> The name of the select box is: skeletor. A play on the word selector.<br>"
out = out + "The options for the select box are, Default Value, Option 2, Option 3, Option 4 and Option 5.<br>"
out = out + "The values for each option, from top to bottom, are: " + lucy.skeletor.option(0) + ", "
out = out + lucy.skeletor.option(1) + ", " + lucy.skeletor.option(2) + ", " + lucy.skeletor.option(3)
out = out + ", " + lucy.skeletor.option(4) + ".<br><br>"
out = out + "The index of the first option in the select box is: 0. The location of the user-selected option is: " + lucy.skeletor.value + ".<br><br>"
Mike Felder
  • 139
  • 1
  • 2
  • 10
  • 3
    In order to help you we would have to know what `lucy`, `lucy.skeletor` and `lucy.skeletor.option` are. The error says that one of the two properties you are trying to access don't exist. – Felix Kling May 02 '11 at 08:50
  • We need more information from you. What kind of plugin or framework do you additionaly use? – Reporter May 02 '11 at 08:52

2 Answers2

1

I'd think lucy.skeletor.option(1) will be the problem here. If lucy.skeletor is a genuine select element, it contains an options array. That array can be referenced like: lucy.skeletor.options[n]

furthermore, if you concatenate, you could do:

out += somestring+someotherstring+morestrings ... etc
KooiInc
  • 119,216
  • 31
  • 141
  • 177
  • my god you're right about the +=, I've been switching between VBScript and JavaScript for class and its making things fall through the cracks... I'll try the fixes you suggested real fast and let you know. – Mike Felder May 02 '11 at 09:00
  • In this case it might be even better to use `[string, string, ...].join('')`. – Felix Kling May 02 '11 at 09:05
  • Everything cleared the IE debugger, now just no HTML is rolling out :-\ I'll mess with it. Thank you Kooilnc – Mike Felder May 02 '11 at 09:12
1

out = out + ... is ok, just not necessary. Your problem is using .option(1) which is accessessing a non-existing collection

If skeletor is a then the correct syntax for newer browsers is

lucy.options[1].value or .text

Here is what I think you meant

var out = "";
out += "<b>Select Box Information</b><br><br> The name of the select box is: skeletor. A play on the word selector.<br>"
out += "The options for the select box are, Default Value, Option 2, Option 3, Option 4 and Option 5.<br>"
out += "The values for each option, from top to bottom, are: "
var opts=[]; 
for (var i=0;i<lucy.skeletor.options.length;i++) opts.push(lucy.skeletor.options[0].text); 
out += opts.join(", ");
out += ".<br><br>"
out += "The index of the first option in the select box is: 0. The location of the user-selected option is: " + lucy.skeletor.value + ".<br><br>"
mplungjan
  • 169,008
  • 28
  • 173
  • 236