Search code examples
javascripthtmldomdom-eventsmouseevent

HTML/DOM: Mouse-events to change button


In IE9, this code does not change the size of button as intended...

<html><head>
<script language="JavaScript">
    function fun1()
    {
        alert("clicked");
        document.form1.chk1.disabled=true;
    }
    function m1()
        {
            document.form1.chk1.width=60;
        }
    function m2()
        {
            document.form1.chk1.width=40;
        }
</script>
</head><body>
<form name="form1"><!-- creating radio button group -->
    <input type="button" name="chk1" value="red" onClick="fun1()"
    onMouseOver="m1()" onMouseOut="m2()">
</form>
</body></html>

Solution

  • well there was this style attribute missing in your code. try replacing this

    document.form1.chk1.style.width="60%";
    

    this worked with me