<!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>
JS基础—获取document元素
最新推荐文章于 2024-01-04 17:37:30 发布