1. today, I suddenly thought that the time for the jquery benefits is useless. I just practiced it. Who knows, I met the problem of jquery's difference in IE and FF browsers. I don't have to talk about it anymore, let's take a look at the problem.
2. Most of those who have used jquery know that the effect of viewing on FF is just the same, but the effect of these just-obtained results is unsatisfactory in IE.
3. The effect of today's exercises is as follows:
Is to click each color, and then make the background color of the page the same color
4. The results in can be completed with simple code, and the effects in IE and FF are the same. Here we only paste the code in jquery, which is very simple.
Copy codeThe Code is as follows:
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("Div span"). each (function (){
$ ("Div span"). click (function (){
Var index = $ ("div span"). index (this );
$ ("# Css "). attr ("href", "css/index" + index + ". css "); this css is in <link rel =" stylesheet "type =" text/css "href =" css/index.css "id =" css ">, this line of code is in HTML. I believe everyone knows it.
If (index = 7 ){
$ ("# Css"). attr ("href", "css/index.css ");
}
});
});
});
</Script>
Below is the code in HTML
Copy codeThe Code is as follows:
<Div align = "right" id = "div">
<Span class = "myBox">
</Span>
<Span class = "myBox1">
</Span>
<Span class = "myBox2">
</Span>
<Span class = "myBox3">
</Span>
<Span class = "myBox4">
</Span>
<Span class = "myBox5">
</Span>
<Span class = "myBox6">
</Span>
<Span class = "myBox7"> restore </span>
The following css style will not be pasted out. I believe everyone knows it.
Next I will talk about another different code, so that I can understand the use of IE and FF for jquery.
1.
The difference between this image and the above image is easy for you to find out. Right, the four corners of this small icon are radians. To achieve this, I used a js. This js is the "jquery. curvycorners. source. js
Copy codeThe Code is as follows:
$ (Document). ready (function (){
Settings = {
Tl: {radius: 10 },
Tr: {radius: 10 },
Bl: {radius: 10 },
Br: {radius: 10 },
AntiAlias: true,
AutoPad: true,
ValidTags: ["span"]
}
$ ('. Mybox'). corner (settings );
$ ('. MyBox1'). corner (settings );
$ ('. MyBox2'). corner (settings );
$ ('. MyBox3'). corner (settings );
$ ('. MyBox4'). corner (settings );
$ ('. Mybox5'). corner (settings );
$ ('. MyBox6'). corner (settings );
$ ('. Mybox7'). corner (settings );
});
This method turns the four corners of the above image into radians, but the problem arises.
In this method, js runs very effectively on FF, but it does not work when it appears on IE.
I have never paid attention to it before, but after testing today, I have a little comments about whether it is not very good for the compatibility of some custom js and IE. I have worked on a project before, I also customized a js file and then embedded it into the page through the Script. FF worked very well, but it didn't work on IE, and I didn't care at the time. Through today's exercises, I found that, "isn't IE compatibility good for some custom js?" Is it true? Do you want to use as few custom js as possible in the future? But if you do not use custom js, there will be a lot of code in the page? A little confused ING...