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
Sysbench is an excellent benchmark tool that can ...
Table of contents Vue CLI builds a Vue project Vu...
<br /> Note: All texts, except those indicat...
The environment of this article is Windows 10, an...
Use canvas to write a colorful clock! 1. Title (1...
Introduction to Swap Swap (i.e. swap partition) i...
Implement div wheel zooming in and out in Vue pro...
When position is absolute, the percentage of its ...
In order to facilitate the storage and access of ...
Linux is currently the most widely used server op...
Table of contents 1. Introduction 2. Switching 1....
I don't expect to be an expert DBA, but when ...
Find two test machines: [root@docker1 centos_zabb...
Automated build means using Docker Hub to connect...
First of all, what is 404 and soft 404? 404: Simpl...