最近在做项目的时候,实现一个很简单的加入收藏夹的功能,网上代码多的是,如下就是我整理的一个版本

 

 

 

      注:如果该页面没有放在服务器(如tomcat)上 ,而是放在普通文件夹中(如桌面),则浏览器状态栏会报没有权限的错误,具体原因有待研究,不属于本次讨论的范围。

      我将以上代码放到服务器中并执行时,IE7浏览器状态栏报错,“找不到元素”,但同事的浏览器可以正常访问,也能添加到收藏夹。故确定是我的浏览器的问题。

Google搜到国外一个帖子,如下:

GWT not working on Internet explorer 7 (IE7) giving "Element not found" javascript error

 

GWT web application started to give "Element not found" javascript error message on Internet Explorer 7 (IE7)? This application worked fine on Internet Explorer 6 and Firefox 2. Now your best guess would be; GWT not working on IE 7 properly. Wasn't it? 

 

But the scenario became confusing and unbelievable because your application worked fine on IE7 in some machines while not on some others. Have you faced this issue? Then the below solution is for you.

 

This issue can be fixed by a making a change on windows registry. 

 

Steps to follow are;

1. Open up the Registry editor - type regedit on command prompt.

 

2. Look for the key shown below

HKEY_CLASSES_ROOT\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32

 

3. Click on the "Default" row and see the value there. If it's value is "C:\WINDOWS\system32\shdocvw.dll", then that is what causes the above mentioned issue. If you have installed Windows in a different drive; C:\ must be replaced with the that letter.

 

4. Replace that value with "C:\WINDOWS\system32\ieframe.dll".

          5. Now restart IE7, and load your GWT application.

 

    

     于是猛然想起,我之前也装过IE8的测试版,但是后来又被我卸载了,原因就在于此,按照上述方法,更改了注册表,重启IE7,运行没有问题。

 

       另外也顺便收藏了IE和FF都适用的方法:

 

 

写完手工。