The error message returned when the javascript code is incorrect. The answer is "select all". the code is as follows: HTMLcode & lt; html & gt; & lt; body & gt; & lt; script & gt; what is wrong with this javascript code?
The select all function is invalid:
The code is as follows:
HTML code
Script document. write ("
"); For (var I = 0; I <20; I ++) {document. write ("
- "); Document. write ('Heihei'); document. write ("
");} Document. write ("
"); ScriptSelect all scripts var cnames = document. getElementsByName ("arr []"); alert (cnames. length); function all (obj) {for (var I = 0; I
------ Solution --------------------
Use firebug and debug it.
------ Solution --------------------
It is best to use Firefox firbug debugging in js.
------ Solution --------------------
All is a reserved JavaScript word and cannot be used as a function name.
------ Solution --------------------
Discussion
Var cnames = document. getElementsByName ("arr []");
------ Solution --------------------
Discussion
All is a reserved JavaScript word and cannot be used as a function name.