changeDiv (改变样式)

原创 2019-03-03 15:11:53 165
摘要:<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0">&

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<meta http-equiv="X-UA-Compatible" content="ie=edge">

<title>changediv</title>

<style>

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

</style>

</head>

<body>


<div id='box'></div>

<input type="button" value="变宽" onclick="Javascript:return document.getElementById('box').style.width='400px'">

<input type="button" value="变高" onclick="Javascript:return document.getElementById('box').style.hight='400px'">

<input type="button" value="变色" onclick="Javascript:return document.getElementById('box').style.background='red'">

<input type="button" value="重置" onclick="Javascript:return document.getElementById('box').style.height('400px').Width('400').background('red')">

<input type="button" value="隐藏" onclick="Javascript:return document.getElementById('box').style.display='none'">

<input type="button" value="显示" onclick="Javascript:return document.getElementById('box').style.display='block'">

</body>

</html>


批改老师:西门大官人批改时间:2019-03-03 15:21:55
老师总结:高度是height,不是hight,变色的时候设置为其他颜色,原来是red,再设置为red,颜色不会有变化

发布手记

热门词条