"javascript:" on browser won't change the type.

Posted by raj on Stack Overflow See other posts from Stack Overflow or by raj
Published on 2010-03-24T04:20:47Z Indexed on 2010/03/24 4:23 UTC
Read the original article Hit count: 212

Filed under:
|

look at this code,

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function change()
{
 document.getElementById("myInput").type="text";
}
</script>
</head>
<body onload="setTimeout('change()',2000);">
<input type = "button" id="myInput">
</body>
</html>

now, my button becomes text box after 2 seconds.. Iam happy! Why not the same happens when i try to do from the browser (i tested in IE6 & Chrome) using

javascript:document.getElementById("myInput").type="text"

different browsers behave in different way... when i tried javascript:document.getElementById("myInput").value="myNewValue", IE6 changes the value, but chrome doesn't..

Why is this "javascript:" behaving like this ?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about browser