Objiect

导航

-css Text

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>无标题文档</title>

<style>
div { width:100px; height:100px; border:1px solid #333; }
</style>

</head>

<body>

<div id="div1">123</div>

<input id="btn1" type="button" value="按钮" />

<script>
var oDiv = document.getElementById('div1');
var oBtn = document.getElementById('btn1');

oDiv.onclick = function (){
// oDiv.style.width = '200px';
oDiv.style.cssText = ' width:200px; height:200px; ';
};
oBtn.onclick = function (){
// oDiv.style.width = '100px';
oDiv.style.cssText = '';
};

</script>

</body>
</html>

posted on 2017-06-07 17:48  BigBiuBiu  阅读(106)  评论(0编辑  收藏  举报