搜索 | 用户支持

防范以用户支持为名的诈骗。我们绝对不会要求您拨打电话或发送短信,及提供任何个人信息。请使用“举报滥用”选项报告涉及违规的行为。

Learn More

removeAttribute doesn't seem to do so.

  • 1 个回答
  • 1 人有此问题
  • 15 次查看
  • 最后回复者为 briansmither

more options

I am trying to do this in an <img id='player' src=' ' alt='alt' title='title' border='0' onerror="document.getElementById('player').removeAttribute('src');document.getElementById('player').removeAttribute('alt');document.getElementById('player').removeAttribute('title');" /> tag.

When I view Generated Source in FF2 (Web Developer 1.1.9), the attributes are not shown in the source listing, and the title attribute still displays in the page.

When I view Generated Source in FF4, the attributes are present in the source listing, and the title attribute still displays on the page.

I am trying to do this in an &lt;img id='player' src=' ' alt='alt' title='title' border='0' onerror="document.getElementById('player').removeAttribute('src');document.getElementById('player').removeAttribute('alt');document.getElementById('player').removeAttribute('title');" /&gt; tag. When I view Generated Source in FF2 (Web Developer 1.1.9), the attributes are not shown in the source listing, and the title attribute still displays in the page. When I view Generated Source in FF4, the attributes are present in the source listing, and the title attribute still displays on the page.

由briansmither于修改

所有回复 (1)

more options

(In my original post above, I had to use a space as the value for the src attribute, otherwise this editor would not show it. But my actual code is a zero-length string.)

I believe that FF4 does not consider a zero-length string as a triggerable error. I change the src attribute's value to '#' and all is working as desired.

由briansmither于修改