<!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的属性可以改一下,效果就变了:
<!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>