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
Preface echarts is my most commonly used charting...
In this project, the Docker container is used to ...
Table of contents Scenario Core Issues Status mon...
Table of contents Preface Add sudo write permissi...
We all know that the commonly used positioning me...
Today I had some free time to write a website for...
Preface JavaScript continues to grow and prosper ...
Table of contents 1. Install node 2. Install Comm...
1. First, understand the overflow-wrap attribute ...
vue implements the drag and drop sorting function...
Table of contents 1. Scenario 2. Implement IJavaS...
Pre-installation preparation The main purpose of ...
By chance, I discovered that a SQL statement prod...
To set the line spacing of <p></p>, us...
Table of contents 1. Select database USE 2. Displ...