why my “myns:button” don’t become red in IE 6 / 7 / 8 unlike in Firefox / Opera / Safari / Chrome ?
<html>
<head>
<script type="text/javascript">
window.onload = function() {
var tmp = document.getElementsByTagName('myns:button');
for (i = 0; i < tmp.length; i++) {
tmp[i].style.color = '#FF0000';
}
};
</script>
</head>
<body>
<myns:button>My NS Button</myns:button>
</body>
</html>
I already tried to prepend the following to my js :
document.createElement('myns:button');
But that doesn’t work in IE, why ?
Thanks.
Like the others I really recommend that you don’t do this. But …
If you really want to, and you’re not too concerned about validation you can do:
Change http://www.example.com/namespaces for your own namespace name.
Tested in latest versions of FF, Chrome, Opera and in IE6, IE7 and IE8.
See http://msdn.microsoft.com/en-us/library/ms534388%28VS.85%29.aspx as a starting place for information about how this works in IE.