


Difference analysis of each browser's support for link tag onload/onreadystatechange events_javascript skills
1. onload event
< ;/HEAD>
IE6/7 :
IE8/9 :
Opera :
That is, IE6/7/8/9/Opera all support the onload event, but Firefox/Safari/Chrome do not support it.
Note: Use JS to create the link tag and add it to the head. The situation is as above.
2, onreadystatechange event
< link type="text/css" rel="stylesheet" href="http://i3.sinaimg.cn/rny/webface/login/css/login101021_min.css" onreadystatechange="alert(this)"/>
Two pop-ups in IE6/7/8/9 This time, other browsers did not play. Note that only IE supports the onreadystatechange event of the link element. It pops up twice: readyState is loading and complete state. ReadyState can be used to determine the loading status. Let’s try using JS to dynamically create link elements,
< ;!DOCTYPE HTML>
<script> <br>function createEl(type, attrs){ <br>var el = document.createElement(type), <br>attr; <br>for(attr in attrs){ <br>if(attrs.hasOwnProperty(attr)){ <br>el.setAttribute(attr, attrs[attr]); <br>} <br>} <br>return el; <br>} <br>var link = createEl('link', { <br>href : 'http://i3.sinaimg.cn/rny/webface/login/css/login101021_min.css', <br>rel : 'stylesheet', <br>type : 'text/css' <br>}); <br>link.onreadystatechange = function(){ <br>alert(this) <br>} <br>document. getElementsByTagName('head')[0].appendChild(link); <br></script>
IE6/ Still popped up 2 times on 7/8/9. Firefox/Safari/Chrome still doesn't work. Everything seems to be normal, but the amazing thing is that this time it pops up in Opera, indicating that Opera supports the onreadystatechange event when dynamically creating link elements.
Related:
https://developer.mozilla.org/en/HTML/Element/link
http://msdn.microsoft.com/en-us/library/ms535848( v=VS.85).aspx
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/level-one-html.html#ID -35143001

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



SpringBoot and SpringMVC are both commonly used frameworks in Java development, but there are some obvious differences between them. This article will explore the features and uses of these two frameworks and compare their differences. First, let's learn about SpringBoot. SpringBoot was developed by the Pivotal team to simplify the creation and deployment of applications based on the Spring framework. It provides a fast, lightweight way to build stand-alone, executable

In the era of mobile Internet, the performance of mobile phones has always been one of the focuses of users. As the leaders in the mobile phone chip market, MediaTek and Qualcomm have also attracted the attention of consumers for their chips. Recently, MediaTek launched the Dimensity 8200 chip, while Qualcomm has its representative Snapdragon series chips. So, what are the differences between these two chips? This article will conduct an in-depth comparative analysis between Dimensity 8200 and Snapdragon. First of all, from the perspective of process technology, Dimensity 8200 uses the latest 6nm process technology, while some of Qualcomm Snapdragon’s

Oracle Database has always been one of the leaders in enterprise-level database management systems, and its continuously updated and iterative versions have also attracted widespread attention. Among them, Oracle11g and Oracle12c versions are relatively representative versions and have many differences. This article will explain some important differences between Oracle11g and Oracle12c, and attach specific code examples to help readers gain a deeper understanding of the differences between the two versions. 1. Architecture differences Oracle1

Version Control: Basic version control is a software development practice that allows teams to track changes in the code base. It provides a central repository containing all historical versions of project files. This enables developers to easily rollback bugs, view differences between versions, and coordinate concurrent changes to the code base. Git: Distributed Version Control System Git is a distributed version control system (DVCS), which means that each developer's computer has a complete copy of the entire code base. This eliminates dependence on a central server and increases team flexibility and collaboration. Git allows developers to create and manage branches, track the history of a code base, and share changes with other developers. Git vs Version Control: Key Differences Distributed vs Set

Quality evaluation: The difference between OnePlus and Honor In today’s fiercely competitive environment in the mobile phone market, consumers have increasingly higher quality requirements for mobile phones. Among many mobile phone brands, OnePlus and Honor are among the most popular brands and are favored by consumers. The two have a certain say in the market, but what is the difference in quality? This article will conduct a comparative evaluation between OnePlus and Honor in terms of mobile phone quality, performance, user experience, etc. to help consumers better choose the mobile phone brand that suits them. 1. Appearance design OnePlus mobile phones have always been simple and elegant.

Differences between Go language and Java: Syntax and programming model Go language and Java are both modern and popular programming languages with many similarities, but there are also many differences. These differences are mainly reflected in syntax and programming models. Syntax 1. Variable declaration In Go language, variable declaration requires the use of var keyword, but it is not required in Java. For example: varaintinta; 2. Type inference Go language supports type inference, that is, the compiler can automatically infer the type of variables. For example: a:=10

Differences and comparisons between Tomcat and Nginx With the rapid development of the Internet, the demand for network applications is getting higher and higher, and web servers have also received more and more attention. As two widely used web servers, Tomcat and Nginx show their respective advantages and characteristics in different scenarios. This article will compare Tomcat and Nginx from different perspectives and explore their differences. 1. Background Before comparing Tomcat and Nginx in depth, let’s first understand their

Golang is a popular programming language with a unique design concept in concurrent programming. In Golang, the management of the stack (heap and stack) is a very important task and is crucial to understanding the operating mechanism of the Golang program. This article will delve into the differences in stacks in Golang and demonstrate the differences and connections between them through concrete code examples. In computer science, stacks are two common ways of allocating memory. They differ in memory management and data storage.
