返回 按钮点击后调用...... 登陆

按钮点击后调用自定义函数改变css属性

弃。 2018-12-12 16:14:45 259

<!DOCTYPE html>

<html>

<head>

<meta charset="utf-8">

<title></title>

 <style type="text/css">

#box{width: 100px;height: 100px;background:red;margin:50px; }

</style>

</head>

<body>

<script type="text/javascript">

var box 

window.onload = function(){

box = document.getElementById('box')

}

function gao(){

box.style.height = "200px"

}

function kuan(){

box.style.width = "200px"

}

function se(){

box.style.background = "pink"

}

function co(){

box.style.height = "100px"

box.style.width = "100px"

box.style.background = "red"

}

function yin(){

box.style.display = "none"

}

function xan(){

box.style.display = "block"

}

</script>

<div id="box">


</div>

<button onclick="gao()">变高</button>

<button onclick="kuan()">变宽</button>

<button onclick="se()">变色</button>

<button onclick="co()">重置</button>

<button onclick="yin()">隐藏</button>

<button onclick="xan()">显示</button>

</body>

</html>

~K~QVJOLQ@[8}OYAM}RO~PY.png

最新手记推荐

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

全部回复(0)我要回复

暂无评论~
  • 取消 回复 发送
  • PHP中文网