When you look for elements similar to name= "2nd_btn" with Queryselector () or Queryselectorall (), both Ff,chrome and IE8 make an error.
The ff,chrome of the newspaper is the same, as follows:
Error:uncaught exception: [Exception ... "An invalid or illegal string is specified" code: "A" Nsresult: "0x8053000c (Ns_error_dom_syntax_err)" Location: ".../te St/qsa.html line:18 "]
IE8 Error Prompt: line: 18 Wrong: parameter is invalid.
One thought, the value of name begins with a number, and the number is removed or modified to be taken.
This tells us that when a property value for a label is generally customizable, the property value cannot begin with a number, nor can it contain infrequently used characters such as $,^.
At the beginning of the HTML page be sure to remember to declare <! Doctype>.
Test code:
Copy Code code as follows:
<! Doctype>
<body>
<div id= "foo" >
<a N Ame= "warns" href= "" >this is a sample warning</a>
<a id= "3err" href= "" >this is a sample Error</a> ;
</div>
<div id= "Bar" >
<a name= "warns" href= "" >this is another sample warning</a>
<a name= "1err" href= "" >this is another sample error</a>
</div>
<script>
var A = Document.queryselectorall ("[Name=warns]")
Alert (a.length)//output: 2
var b = Document.queryselector ("[Id=3err] ")
Alert (b.tagname)//error
var c = Document.queryselectorall (" [Name=1err] ")
Alert (c.length)/error
</ Script>
</body>