开发者

Index or size is negative or greater than the allowed amount" code: "1 [Break On This Error] return selector.options[selector.selectedIndex].value;

Index or size is negative or greater than the allowed amount" code: "1 [Break On This Error] return selector.options[selector.selectedIndex].value; Line 38 I keep getting the error and not sure why. here is the js code

http://pastebin.com/H66NTvrU

And here is my template code

        <form id="selector">
            <select id="book" onchange="initChapSelector();"></select>
            <select id="chap" onchange="initPageSelector();"></select>
            <select id="page" onchange="initDisplay();"></select>
            <select id="scale" onchange="setScale(this.options[this.selectedIndex].value);">
                <option value="">Original Width</option>
                <option value="100%">Page Width</option>
                <option value="50%">Half Page</option>
            </select>
            <a href="javascript:void(0)" onclick="alert('Arrow up/开发者_StackOverflow中文版down: scroll\nArrow left/right: prev/next page'); return false;">Help</a>
        </form>

Am very new to coding so please forgive me if any of the above is wrong It would be nice if someone could help me out on this as I seem to have been sitting here ages trying to work this out, Am sure some one will spot the mistake in a few seconds lol...

Thanks alot


I copied your code into jsfiddle, here: http://jsfiddle.net/dMcyg/

I get an error right away when changing the pick list value "setScale is not defined." I can see it is, but there are many syntax problems in the script, so I am guessing there's a parsing issue serious enough that it never gets that far.

You have functions defined inside inner braces, which is illegal. There are lots of missing semicolons (though most browsers other than IE will let these pass).

Go through it with jsLint and fix all the syntax problems first, then see where you are.

Oh - jsLint complains that "interface is a reserved word" for your variable interface. I have never heard of an "interface" keyword in Javascript before, so I am not sure what this is all about, but I changed it so jsLint would continue parsing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜