![jquery 创建div - 加菲 - 加菲猫 jquery 创建div - 加菲 - 加菲猫](http://img1.ph.126.net/yz4dYuovRcjXZM3MUlpQfw==/6597542556657308701.jpg)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<title>jquery</title>
<script>
var boardDiv = "<div style='background:white;width:100%;height:100%;z-index:999;position:absolute;top:0;margin-top:100px;'>加载中...<\/div>";
$(window).load(function(){
//window.alert("ok");
$(document.body).append(boardDiv);
});
</script>
</head>
<body>
</body>
</html>
div的属性可以改一下,效果就变了:
![jquery 创建div - 加菲 - 加菲猫 jquery 创建div - 加菲 - 加菲猫](http://img1.ph.126.net/Em0ZQ_FVFcFhIsxbTMl3LA==/6598289125052356894.jpg)
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<style>
.msg{
background:#898989;width:200px;height:60px;z-index:999;position:absolute;top:0;margin-top:100px;
}
</style>
<title>jquery</title>
<script>
var boardDiv = "<div class='msg'>加载中...<\/div>";
$(window).load(function(){
//window.alert("ok");
$(document.body).append(boardDiv);
});
</script>
</head>
<body>
</body>
</html>