javascript控制div信息居中
最经使用jquery.form.js做了一个查询页面,在搜索出结果后,需要分页,在分页中点击下一页页才用ajax提交,在提交没有返回结果是需要给客户显示一下正在加载数据,故用jquery.1.3.2.js做了一个信息提示的脚本。
代码如下:
<div id="loadProcess" style="z-index:1;visibility:hidden;width:300px;position:absolute;top:0px;left:0px;height:58px;border:1px solid #ccc;text-align:center;background:#fff;">
<ul>
<li></li>
<li><IMG height=9 src="../images/wait.gif" width=100></li>
<li></li>
<li>【 正在加载数据...... 】</li>
<li></li>
</ul>
</div>
脚本代码:
function loadProcess(id){
var wnd = $(window), doc = $(document);
var left = doc.scrollLeft();
var top = doc.scrollTop();
//alert("scrollLeft:"+doc.scrollTop());
//alert("windowHeight:"+wnd.height());
left += (wnd.width() - $(id).width())/2;
top += (wnd.height() - $(id).height())/2;
//alert("top:"+top);
$(id).css("top",top);
$(id).css("left",left);
$(id).css("visibility","visible");
}
相关文档:
自从学习JavaScript以来,一直对函数闭包不是太理解。知道大概是什么个意思,但是要将一个不会的人教会还真不行。总之就是不能彻底的理解。
今天看到的这篇文章感觉不错,和大家分享一下。
http://www.felixwoo.com/archives/247 ......
Definition and Usage
定义与用法The constructor property is a reference to the function that created an object.
constructor属性是所建立对象的函数参考Syntax
语法object.constructor
Example 1
举例
In this example we will show how to use the constructor property:
在这个举例中我们将展示如何使用cons ......
1.document.write( " "); 输出语句
2.JS中的注释为//
3.传统的HTML文档顺序是:document- >html- >(head,body)
4.一个浏览器窗口中的DOM顺序是:window- >(navigator,screen,history,location,document)
5.得到表单中元素的名称和值:document.getElementById( "表单中元素的ID號 ").name(或value)
6.一个 ......
网页常用小技巧
1. oncontextmenu="window.event.returnValue=false" 将彻底屏蔽鼠标右键
<table border oncontextmenu=return(false)><td>no</table> 可用于Table
2. <body onselectstart="return false"> 取消选取、防止复制
3. onpaste="return false" 不准粘贴
4. oncopy="return fa ......