<SCRIPT>
function fnClear(){
var p=document.createElement('p')
p.appendChild(document.createTextNode(oSource.children[0].outerHTML))
oSource.children[0].clearAttributes();
p.appendChild(document.createTextNode(" ---------------------------------------------------------------------"))
p.appendChild(document.createTextNode(oSource.children[0].outerHTML))
document.body.appendChild(p)
}
</SCRIPT><SPAN ID=oSource>
<DIV
ID="oDiv"
ATTRIBUTE1="true"
ATTRIBUTE2="true"
onclick="alert('click');"
onmouseover="this.style.color='#0000FF';"
onmouseout="this.style.color='#000000';"
style="background-color=red"
>
This is a sample <b>DIV</b> element.
</DIV>
</SPAN><INPUT
TYPE="button"
VALUE="Clear Attributes"
onclick="fnClear()"
>
function fnClear(){
var p=document.createElement('p')
p.appendChild(document.createTextNode(oSource.children[0].outerHTML))
oSource.children[0].clearAttributes();
p.appendChild(document.createTextNode(" ---------------------------------------------------------------------"))
p.appendChild(document.createTextNode(oSource.children[0].outerHTML))
document.body.appendChild(p)
}
</SCRIPT><SPAN ID=oSource>
<DIV
ID="oDiv"
ATTRIBUTE1="true"
ATTRIBUTE2="true"
onclick="alert('click');"
onmouseover="this.style.color='#0000FF';"
onmouseout="this.style.color='#000000';"
style="background-color=red"
>
This is a sample <b>DIV</b> element.
</DIV>
</SPAN><INPUT
TYPE="button"
VALUE="Clear Attributes"
onclick="fnClear()"
>
下面是微软的官方例子
但是 当你点击清除按钮后 没有效果 点击p后还是能弹出“click” 并且有滑动变色效果
完全没有意义嘛!!!!!!
<SCRIPT>
function fnClear(){
oSource.children[0].clearAttributes();
}
</SCRIPT><SPAN ID=oSource>
<DIV
ID="oDiv"
ATTRIBUTE1="true"
ATTRIBUTE2="true"
onclick="alert('click');"
onmouseover="this.style.color='#0000FF';"
onmouseout="this.style.color='#000000';"
>
This is a sample <b>DIV</b> element.
</DIV>
</SPAN><INPUT
TYPE="button"
VALUE="Clear Attributes"
onclick="fnClear()"
>
所以clearAttributes属性id,style不能被清除,script-only字面上能被清除 但效果不变(好像是执行在脚本里的 和这无关)每一个人回帖啊???
这帖子真够冷的下面赶紧来个人 我好结贴给分