javascript为什么加载不了,各种操作无效,求大佬

<!doctype html>

<html>

<head>

<meta charset="utf-8">

<title>javascript</title>

<style>

*margin{margin: 0px;padding: 0px;float: left;}

.div1{

width: 400px;

height: 400px;

background: red;

}

</style>

<script>

var x=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight;

y=document.getElementById("div1");

y.innerHTML="浏览器的高度为"+x+".";

function towidth(){

var oDiv=document.getElementById("div1");

oDiv.style.width=600 px;

}

function turn(name,value){

var odiv=document.getElementById('div1');

odiv.style[name]=value;

}

</script>

</head>


<body>

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

<input type="button" value="变高" onclick="turn('height','600px')"/>

<input type="button" value="变绿" onclick="turn('color','green')"/>

<div class="div1"></div>

</body>

</html>


慕侠1089519
浏览 1787回答 3
3回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript