For example: Copy code The code is as follows:<input type="checkbox" id="a"><label for="a"><img src="..."></label> The effect we want to achieve is: click "Bank of China" and the checkbox will be selected (or cancelled). There is no problem in browsers such as FireFox and CHROME, but IE browser does not accept this. The solution is to use JS: Copy code The code is as follows:window.onload = function(){ if(document.all && navigator.appVersion.indexOf("MSIE")>-1 && navigator.appVersion.indexOf("Windows")>-1) { var a = document.getElementsByTagName("label"); for(var i=0,j=a.length;i<j;i++){ if(a[i].hasChildNodes && a[i].childNodes.item(0).tagName == "IMG") { a[i].childNodes.item(0).forid = a[i].htmlFor; a[i].childNodes.item(0).onclick = function(){ var e = document.getElementById(this.forid); switch(e.type){ case "radio": e.checked|=1;break; case "checkbox": e.checked=!e.checked;break; case "text": case "password": case "textarea": e.focus(); break; } } } } } } |
<<: Web Design Principles of Hyperlinks
>>: Detailed explanation of MySQL user rights management
Background: position: sticky is also called stick...
1. Introduction Nginx is a free, open source, hig...
This article example shares the specific code of ...
1. Construction components 1. A form must contain...
Password Mode PDO::__construct(): The server requ...
<br />Original: http://www.alistapart.com/ar...
This article shares a dynamic loading progress ba...
Welcome to the previous canvas game series: 《VUE ...
Table of contents 1. Developer Platform Configura...
The upload form with image preview function, the ...
Of course, it also includes some personal experien...
Table of contents 1. Master-slave synchronization...
Table of contents Prototype chain diagram Essenti...
Recently, we need to perform a scheduled migratio...
Create a new server.js yarn init -y yarn add expr...