Con Object.prototype si possono creare nuovi metodi.
codice:
Object.prototype.hide = function() { this.style.display="none"; };
Ma IE6 ovviamente non supporta Object.prototype. A tale scopo si utilizza un ( scomodissimo ) file .htc:
codice:
<PUBLIC:COMPONENT>
<PUBLIC:METHOD NAME="hide" INTERNALNAME="_hide" />
<script type="text/javascript">
var el = new Object;
_hide = el.hide;
</script>
</PUBLIC:COMPONENT>
da inserire nel css
codice:
* { behavior: url(myObj.htc); }
Ora pongo alcune domande:
1) IE7 supporta i file htc? ( da alcune ricerche mi pare di no )
2) IE7 supporta Object.prototype?
3) E' possibile usare innerHTML su un tag style per scrivere codice css al suo interno?