主页 > 前端 > javascript >
来源:未知 时间:2014-09-22 19:03 作者:xbdadmin 阅读:次
[导读] script language=javascript window.onload = function(){ var doc = document; var box_1 = doc.createElement(div); box_1.setAttribute(id,box); var _body = doc.getElementsByTagName(body); _body[0].appendChild(box_1); var box_id = doc.getElementB...
<script language="javascript">
window.onload = function(){
var doc = document;
var box_1 = doc.createElement("div");
box_1.setAttribute("id","box");
var _body = doc.getElementsByTagName("body");
_body[0].appendChild(box_1);
var box_id = doc.getElementById("box");
box_id.style.width = "100px";
box_id.style.height = "100px";
box_id.style.background = "#f00";
box_id.style.position = "absolute";
//鼠标在窗口移动
doc.onmousemove = function(e){
var e = e || window.event;
var _x = e.pageX||e.clientX;
var _y = e.pageY||e.clientY;
box_id.style.left = _x+"px";
box_id.style.top = _y+"px";
}
}
</script>
|
自学PHP网专注网站建设学习,PHP程序学习,平面设计学习,以及操作系统学习
京ICP备14009008号-1@版权所有www.zixuephp.com
网站声明:本站所有视频,教程都由网友上传,站长收集和分享给大家学习使用,如由牵扯版权问题请联系站长邮箱904561283@qq.com