With the popularity of Windows 7, the team of IE 8 browsers has gradually grown. however, we suddenly found that many web pages have problems. Even worse, our website editor is useless, and all the buttons are useless, even other browsers.
This is written in a buddy's post. Open the editor. js file under include and there is such a code segment:
If (element. yuseronclick ){
Eval (element. yuseronclick + "anonymous ()");
}
Or
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
Or
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
This is because IE8 has blocked the anonymous method, so it needs to be changed to the click method. However, I have made another amazing discovery, that is to say, after this change, the editor in IE7 will be useless. In addition to the pain, I went to the Internet to check whether the Internet is as high as the cloud, and I found the answer on csdn:
If (navigator. appversion. Match (/8./I) = '8 .')
{
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
}
Else
{
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
If the problem persists, use the following
If (navigator. appversion. match (/8. /I) = '8. '| navigator. appversion. match (/7. /I) = '7. '){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event)"); // IE8 or IE7
} Else {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()"); // IE6
}
After the code is changed to this, it will work in IE7 and IE8.
========================================================== ======================================
The above is the voice of one person, and the following is the voice of another person
There is also an issue with the ewebeditor.
Check the background of an old website of the company today and find that the ewebeditor cannot be edited.
Find the editor. js file and run the IF (element. yuseronclick) eval (element. yuseronclick + "anonymous ()") Statement in the file ()");
Modify
If (navigator. appversion. Match (/8./I) = '8 .')
{
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
}
Else
{
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
The reason is that IE8 does not support anonymous (), so it must be replaced with an onclick (event) event.
After modification, a colleague could not use the editor normally when using IE7. After modification, the editor can be used.
It is estimated that this line of code is still a problem. In the past, IE7 was allowed, but IE8 was not. It seems that you must determine the IE version before writing different code.
The following code is used:
If (navigator. appversion. Match (/8./I) = '8 .'){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
} Else {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
After modification, the ewebeditor can be used normally in both IE8 and IE7.
However, you cannot use this editor when using the browser with IE8 installed. It's a bit confusing. It should be okay if you are using the IE kernel.
So I used alert (navigator. appversion) to pop up the information and found that it was IE7?
Dizzy! Actually different? Isn't aoyou using the true IE8 kernel? Or is the problem displayed?
Can I add another sentence to judge the Outstanding game?
No way:
If (navigator. appversion. Match (/8./I) = '8. '| navigator. appversion. Match (/Maxthon/I) = 'maxthon '){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
} Else {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
A few days ago, I read the news that aoyou developed its own kernel browser. I hope that many browsers will be better compatible with the Code. Do not waste so much time coding for incompatibility issues or debugging incompatibility issues.
If not, use the following method (this code is feasible, I will use this code to Solve the Problem ):
Try {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
Catch (e ){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
}
========================================
I used the following method to solve the problem:
----------------------------------------------
Similar Abstract:
Simple Solution for ewebeditor failure in IE7 and IE8
In IE7 and IE8, the buttons for uploading images and so on cannot always pop up normally. People are very depressed. I searched the internet for a solution and found the editor under the Code Editor directory Js. JS file, find the following code
If (element. yuseronclick ){
Eval (element. yuseronclick + "anonymous ()");
}
Replace it with the following code:
The following is a reference clip:
If (navigator. appversion. match (/8. /I) = '8. '| navigator. appversion. match (/7. /I) = '7. '){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event)"); // IE8 or IE7
} Else {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()"); // IE6
}
After replacement, the problem persists. Tnnd, find the code written by another renxiong and replace it:
The following is a reference clip:
If (navigator. appversion. Match (/MSIE (7 | 8) \./I )! = NULL ){
If (element. yuseronclick) eval (element. yuseronclick + "onclick (event )");
} Else {
If (element. yuseronclick) eval (element. yuseronclick + "anonymous ()");
}
Still not working. Both codes fail to solve the problem. depressed, it seems that if the browser is not poisoned, JS cannot get the version normally, that is, my RP is too bad. Therefore, the program does not know how to handle the judgment. I have read the code of the two authors. Although it is well written, it has limitations. Now that you know the cause of the problem, you can do it yourself:
Try {
Eval (element. yuseronclick + "anonymous ()");
}
Catch (error)
{
Eval (element. yuseronclick + "onclick (event )");
}
Test again after writing, OK, normal, haha !! No matter whether it is IE7 or IE8, I will execute another one when I execute an error. If you care about it, haha, the fault tolerance statement works properly.