您的位置:首页 > Web前端 > JavaScript

js小实例(改变宽度)

2008-12-03 14:53 232 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >

<head>

<title>简单练习,设置宽度</title>

<script type="text/javascript">

function f(o){

//alert(o.style.width);如果没有设置style则取值为空

oo.style.width = o.offsetWidth+10+"px";

//o.style.width = "200px";

}

</script>

</head>

<body>

<input id="i1" type="text" style="width:100px;" />

<input id="b1" type="button" value="change" onclick='f(i1);' />

</body>

</html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: