首页 >> Web 开发技术交流
FIREFOX中要实现document.getElementById('redispos').outerHTML怎么办? 阅读:6391回复:5
非常急,请版主指教
|
想其它办法吧
The following element properties (originally from Internet Explorer) are likewise not supported in the W3C Document Object Model: * element.innerText * element.outerText * element.outerHTML Scripts that use these properties will not execute in Firefox, Mozilla and Netscape 6/7 or other standards-compliant browsers. Instead, use the W3C DOM access attributes and access methods described in the next section; since these are supported by Internet Explorer too, then there is no need to use MSIE-specific attributes and methods. 来自: http://www.mozilla.org/docs/web-develop ... ade_2.html |
<div><p id="a">1234</p></div> <button onclick="alert(a.parentNode.innerHTML)">test</button> |
我的需求是这样的
动态取得标签中的文本
如<td id=td1><a href="a.htm">aaaaa</a></td> 因为TD标签中的内容是动态的。页面中还有一组单行按钮,当我选择一个单选按钮时,要重写TD中的内容,并且要在选回原来按钮时再恢复。所以我要用outerHTML取回原来的文本先保存起来。 |