Este artículo proporciona tres formas de desmarcar la radio, y los ejemplos de código son los siguientes:
Este artículo se basa en jQuery, los métodos primero y segundo se implementan utilizando jQuery, y los terceros métodos se implementan en función de JS y DOM.
<! Doctype html> <html> <fead> <title> Tres formas de desmarcar el botón de radio </title> <script type = "text/javaScript" src = "http://lib.sinaapp.com/js/jQuery/1.7.2/jquery.min.js"> </script> <script type = "text/javaScript" () $ Browsers = $ ("Name = Browser]"); $ BROWSERS.ATTR ("CHECKED", FALSO); $ remove.click (function (e) {// vaya directamente al elemento DOM, eliminar atributos // Si no usa jQuery, puede portar este método var checkedbrowser = document.getElementsByName ("browser");/ * $ .each (checkedbrowser, function (i, v) {v.checked = falso; v.removeattribute ("checked");} = checkedbrowser.length; var i = 0; for (; i <len; i ++) {// primero debe asignar falso y luego eliminar el atributo checkedbrowser [i] .ecked = false; // También puede hacer sin eliminar el atributo //CheckedBrowser+font>.removeattribute("Checked "); }}); }); </script> </head> <body> <p> ¿Qué navegador te gusta? </p> <form> <input style = "display: none;" id = "Hidbrowser" type = "Radio" name = "Browser" value = ""> <input type = "Radio" name = "Browser" value = "Internet Explorer"> Internet Explorer <Br /> <input type = "Radio" name = "Browser" Value = "Firefox"> Firefox <Br /> <input type = "Radio name =" Browser "Value =" NetScape "NetScape type = "Radio" name = "Browser" value = "Netscape"> Netscape <Br /> <input type = "Radio" name = "Browser" value = "Opera"> Opera <Br /> <Br /> <input type = "Botón" id = "Cancel" Value = "Unselect Method 1" Tamaño = "20"> <Input type = "Botón" ID = "Byhide" Value = "Value =" Value = "Value =" Value "Inputect Method 2" Sea type = "botón" id = "eliminar" value = "Unselect Method 3" size = "20"> </form> </body> </html>