Struppi: removeAttribute+styleFloat

Beitrag lesen

http://userpage.fu-berlin.de/selfhtml/javascript/objekte/style.htm#remove_attribute

Du meinst: http://de.selfhtml.org/javascript/objekte/style.htm#remove_attribute

Da hab ichs her, wenn da irgendwas fehlerhaftes dran ist etc, sag es mir bitte :-)

Du kannst es testen.

<script type="text/javascript">  
function removeStyle(obj, n) {  
 obj.style.removeAttribute(n, false);  
 alert('typeof style.' + n + ' = ' + typeof (obj.style[n]));  
}  
</script>  
<p style="color:red" onclick="removeStyle(this, 'color')">klick</p>  

wie du siehst ist es nicht weg.

Du hast den gleichen Effekt mit:

function removeStyle(obj, n) {  
 obj.style[n] = '';  
 alert('typeof style.' + n + ' = ' + typeof (obj.style[n]));  
}  

Struppi.