Using colon in html tag and handle its element in javascript

Posted by Fabien Bernede on Stack Overflow See other posts from Stack Overflow or by Fabien Bernede
Published on 2010-05-30T09:02:59Z Indexed on 2010/05/30 9:12 UTC
Read the original article Hit count: 398

Filed under:
|
|
|
|

Hello, 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.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html