Cuando eres un principiante en JavaScript, siempre te torturan problemas muy pequeños durante mucho tiempo todos los días, y esta noche habrá varios problemas pequeños.
Primero: use cotizaciones dobles para causar errores coincidentes
<input type = "checkbox" onMouseOver = "document.getElementById (" test "). style.display =" none ":"/>El error se ha informado al cambiar la carrera: inesperado Toke "}". Revisé durante mucho tiempo y no encontré errores. Descubrí que el video estaba lleno de citas individuales.
<input type = "CheckBox" onMouseOver = "document.getElementById ('test'). style.display =" none ":"/>Después de cambiar a cotizaciones individuales, el error finalmente fue eliminado, lo que me molestó toda la noche. . Adjunte el enlace http://www.cnblogs.com/chinabc/archive/2010/11/19/1881947.html
Segundo: Agregar un punto y coma por error
<div id = "test" onMouseOver = "toyellow ()"; onMouseOut = "tored ()";> cambio </div>
Escriba un punto y coma adicional, lo que resulta en el código después de que no se ejecute el punto y coma
Tercero: escriba más soportes después del nombre de la función
<script> function toyellow () {document.getElementById ("test"). classname = "test2"; } function tored () {document.getElementById ("test"). classname = "test1"; } document.getElementById ("test"). onMouseOver = toyellow (); document.getElementById ("Test"). OnMouseOut = Tored (); </script>Pero después de quitar los soportes después de Toyellow () y Tored (), se ejecutará normalmente
Cuarto: modifique el atributo verificado de la casilla de verificación
Use tres botones para lograr la selección, selección y selección de la casilla de verificación.
<! Doctype html> <html> <fead> <meta charset = "utf-8"> <title> </title> </toad> <body> <button id = "btn"> seleccione todos </botón> <botón ID = "nobtn"> no todos </botte> <botón de botón = "Inverso"> Reselect </boton> <Br/> <Br/> type = "CHECHOBY" TIPE "TIPOTO =" Button ID = "Inverso"> Reselect </Button> <Br/> <Br/> <put type = "CHECHOLO" TIPO) /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkBox" /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkbox" /> <input type = "checkBox" /> <type de entrada de input " type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <input type="checkbox" /> <script> var btn = document.getElementById ("btn"); var input = document.getElementsBytagName ("Entrada"); btn.OnClick = function () {for (var i = 0; i <input.length; i ++) {input [i] .Checked = "checked"; }} var nobtn = document.getElementById ("nobtn"); nobtn.onclick = function () {for (var i = 0; i <input.length; i ++) {input [i] .ecked = false; }} var inverse = document.getElementById ("inverse"); inverse.Onclick = function () {for (var i = 0; i <input.length; i ++) {if (input [i] .ecked == false) {input [i] .ecked = true; } else {input [i] .ecked = false; }}} </script> </body> </html>El artículo anterior hablará sobre errores y soluciones comunes de JavaScript. Este es todo el contenido que he compartido contigo. Espero que pueda darle una referencia y espero que pueda apoyar más a Wulin.com.