Поиск в Поддержке

Избегайте мошенников, выдающих себя за службу поддержки. Мы никогда не попросим вас позвонить, отправить текстовое сообщение или поделиться личной информацией. Сообщайте о подозрительной активности, используя функцию «Пожаловаться».

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