<base href="http://javascript.ru/forum/">
<img id="image" src="images/smilies/smile.gif">
<button onclick="window.image.src = 'images/smilies/tongue.gif'">Сменить src</button>
<script>
(function(){
var MutationObserver = window.MutationObserver || window.WebKitMutationObserver || window.MozMutationObserver;
var observer = new MutationObserver(function(records){
for (var i = 0, record; record = records[i]; i++) {
if (record.attributeName == 'src') {
alert('Атрибут src изменен!');
}
}
});
observer.observe(window.image, {attributes: true});
})();
</script>
|