版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/weixin_36282409/article/details/86561171
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>javascript基础</title>
<script type="text/javascript">
window.function(){
var oBox=document.getElementById("content");
alert(oBox);
oBox.innerHTML("这是通过加载js的内容");
}
</script>
</head>
<body>
<h3>javascript基础:js位置的差异</h3>
<p>操作要求:使用js的语句,在id为"content"的DIV输出一段文字查看位置的区别。</p>
<p>掌握window.onload</p>
<div id="content"></div>
<script type="text/javascript">
var oBox=document.getElementById("content");
alert(oBox);
oBox.innerHTML("这是通过加载js的内容");
</script>
</body>
</html>