Friends said it was incompatible. I went back to debug a compatible version last night:
Copy codeThe Code is as follows:
<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = gbk">
<Script language = "javascript">
Function selectIt (action ){
Var testform = document. getElementById ("bdkey ");
For (var I = 0; I <testform. elements. length; I ++ ){
If (testform. elements [I]. type = "checkbox "){
E = testform. elements [I];
E. checked = (action = "selectAll ")? 1 :(! E. checked );
}
}
}
</Script>
</Head>
<Body>
<Form name = "bdkey" id = "bdkey">
<P class = "STYLE1">
Select All
<Input type = "checkbox" name = "selectAll" value = "checkbox" onClick = "selectIt ('selectall')"> <br>
Invert Selection
<Input type = "checkbox" name = "invest" value = "checkbox" onClick = "selectIt ()"> <br>
Item1
<Input type = "checkbox" name = "checkbox" value = "checkbox">
<Br>
Item2
<Input type = "checkbox" name = "checkbox" value = "checkbox"> <br>
Item3
<Input type = "checkbox" name = "checkbox" value = "checkbox"> <br>
Item4
<Input type = "checkbox" name = "checkbox" value = "checkbox"> <br>
Item5
<Input type = "checkbox" name = "checkbox" value = "checkbox">
</P>
</Form>
</Body>
<Html> <pead> <meta http-equiv = "Content-Type" content = "text/html; charset = gbk"> </pead> <body> </body>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]
At the beginning of this compatibility test, I used a classic js multi-choice box all-selected reverse selection implementation and analysis implementation method, that is, through ev. srcElement, but the debugging was not successful. So we have the current method. Compatibility debugging is partly dependent on your implementation method. I am a fool, but the simplest is often the most effective. Of course, as the pursuit of technology, we all like to use many advanced methods. I won't