返回div改变cs......登陆

div改变css的案列

Risco2018-12-10 21:26:07279

总结:我在这颗学习到了用js控制div里面的css的效果。也做了一个小小的案列

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>Document</title>

<style type="text/css">

#ait{width: 100px;height: 100px;background: #000;


}

</style>

</head>

<body>

<script type="text/javascript">

var ait

window.onload=function(){

ait=document.getElementById("ait")

}

function ait_yx(){

ait.style.borderRadius="50px"

ait.style.width="100px"

ait.style.height="100px"

 

}

function ait_k(){

ait.style.borderRadius="0px"

ait.style.width="600px"



}

function ait_bs(){

ait.style.background="red"

ait.style.borderRadius="0px"

}

function ait_yc(){

ait.style.display="none"

}

function ait_xs(){

ait.style.display="block"

ait.style.height="100px"

ait.style.width="100px"

ait.style.background="#ccc"


}

function ait_csh(){

ait.style.height="100px"

ait.style.width="100px"

ait.style.background="#000"

ait.style.borderRadius="0px"

}


</script>

<div id="ait"></div>


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

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

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

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

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

<input type="button" value="初始化" onclick="ait_csh()">



</body>

</html>


最新手记推荐

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

全部回复(0)我要回复

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