返回用js改变DI......登陆

用js改变DIV样式小实例

꧁༺ 花舞ら花落淚༻ ꧂2019-02-01 21:26:01234

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<title>div改变css样式</title>

<style>

#box{width:200px;height: 200px;background: lawngreen; }

</style>

</head>

<body>

<div id="box"></div>

<input type="button" value="变高" onclick="one()">

<input type="button" value="变宽" onclick="two()">

<input type="button" value="变圆" onclick="tree()">

<input type="button" value="变色" onclick="four()">

<input type="button" value="隐藏" onclick="five()">

<input type="button" value="显示" onclick="six()">

<script>

var box

window.onload=function(){

box = document.getElementById('box');

}

function  one(){

box.style="height:500px;"

}

function two(){

box.style="width:500px;"

}

function tree(){

box.style="border-radius:50%;"

}

function four(){

box.style="background:red;"

}

function five(){

box.style="display:none;"

}

function six(){

box.style="dispaly:black;"

}

</script>

</body>

</html>


最新手记推荐

• 用composer安装thinkphp框架的步骤• 省市区接口说明• 用thinkphp,后台新增栏目• 管理员添加编辑删除• 管理员添加编辑删除

全部回复(0)我要回复

暂无评论~
  • 取消回复发送