日期:2014-05-16  浏览次数:20372 次

找到一点js兼容问题,记录下

IE和Mozilla的一点js区别
这个我不晓得怎么样复制表格进来  就整个html源码拿过来了
<table cellspacing="0" cellpadding="10" width="770" border="1">
??? <tbody>
??????? <tr>
??????????? <td>IE</td>
??????????? <td>Mozilla</td>
??????????? <td>说明</td>
??????? </tr>
??????? <tr>
??????????? <td>document.body.clientHeight(clientWidth)根据HTML的DTD而定方能得到准确值。</td>
??????????? <td>window.innerHeight(innerWidth)根据HTML的DTD而定方能得到准确值。</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>opacity(aplha=20)</td>
??????????? <td>MozOpacity=&quot;0.2&quot;</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>event.clientY(clientX)</td>
??????????? <td>event.pageY(pageX)</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>event.keyCode</td>
??????????? <td>event.which</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>event.srcElement</td>
??????????? <td>event.target</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>window.external.AddFavorite('never-online.net', &quot;never-online'website&quot;); </td>
??????????? <td>window.sidebar.addPanel('never-online.net', &quot;never-online'website&quot;, &quot;&quot;);</td>
??????????? <td>此为添加到收藏夹代码,要兼容更多的浏览器,请看<a target="_blank" href="http://blog.never-online.net/article.asp?id=108">这里的代码</a></td>
??????? </tr>
??????? <tr>
??????????? <td>(DHTML事件-滚轮事件)onmousewheel</td>
??????????? <td>DOMMouseScroll</td>
??????????? <td><a target="_blank" href="http://blog.never-online.net/article.asp?id=67">可参看我的blog这篇文章</a></td>
??????? </tr>
??????? <tr>
??????????? <td>window.showModalDialog</td>
??????????? <td>window.open(url, &quot;name&quot;, &quot;modal=yes&quot;)</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>createPopup()</td>
??????????? <td>xul</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>htc控件</td>
??????????? <td>xbl绑定</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>filter滤镜</td>
??????????? <td>只支持alpha(透明度,部分可通过clip来模拟)</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>obj.setCapture()</td>
??????????? <td>window.captureEvents(Event.eventType)</td>
??????????? <td>&nbsp;</td>
??????? </tr>
??????? <tr>
??????????? <td>obj.attachEvent(type, listener)</td>
??????????? <td>obj.addEventListener(type, listener, useCapture)</td>
??????????? <td>添加事件的方法,如果要兼容,有几种方法,如用Mozilla的读写器来模拟IE的方法,或者用一个全局函数addEvent(type, listener, useCapture)来统一事件处理,或者写一个Event Manager更好一些,也可以在这里统一避免<a target="_blank" href="http://blog.never-online.net/article.asp?id=105">内存泄露</a></td>
??????? </tr>
??????? <tr>
??????????? <td>obj.detachEvent(type, listener)</td>
??????????? <td>obj.removeEventListener(type, listener, useCapture)</td>
??????????? <td>一般情况下,用了attachEvent(addEventListener)方法,最好在beforeunload事件里用detach方法释放掉,这是个好习惯(偷懒的话就不说了:D)</td>
??????? </tr>
??????? <tr>
??????????? <td>支持Webdings字体</td>
??????????? <td