开发者

resize button image using javascript

I want the following button (and it's image) to change size when I click it. The dialog is showing, but the size is not changing..

<html>
    <input type="image" src="pacman.png"  onClick="
        alert('test');
        this.height='200px'; // change de button size
        // this.image.height='200px'; // not sure if this line will work..
    "/>
</html>

Need be in javascript, no in the css, becouse I'll make an anima开发者_Go百科tion later..


You have to manipulate the "style" property:

this.style.height = '200px';


You can do it with

this.style.height = "200px";

BUT, you should look into jQuery, an excellent Javascript library which makes it really easy to do that plus a LOT more! It's worth the small learning curve, trust me. http://www.jquery.com

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜