JavaScript页面刷新与弹出窗口问题解决方法
JavaScript页面刷新与弹出窗口问题解决方法
1.无提示刷新网页
大家有没有发现,有些网页,刷新的时候,会弹出一个提示窗口,点“确定”才会刷新。
而有的页面不会提示,不弹出提示窗口,直接就刷新了.
如果页面没有form,则不会弹出提示窗口。如果页面有form表单,
a)< form method="post" ...> 会弹出提示窗口
b)< form method="get" ...> 不会弹出
2.javascript刷新页面的方法
window.location.reload();
使用window.open()弹出的弹出窗口,刷新父窗口
window.opener.location.reload()
使用window.showDialog弹出的模式窗口
window.dialogArguments.location.reload();
3.Javascript弹出窗口代码
下面给两个弹出屏幕居中窗口的例子
window.open()方式
function ShowDialog(url) {
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(window.screen.height-iHeight)/2;
var iLeft=(window.screen.width-iWidth)/2;
window.open(
url,"Detail","Scrollbars=no,Toolbar=no,Location=no,Direction=no,Resizeable=no,
Width="+iWidth+" ,Height="+iHeight+",top="+iTop+",left="+iLeft
);
}
window.showModalDialog方式
function ShowDialog(url) {
var iWidth=300; //窗口宽度
var iHeight=200;//窗口高度
var iTop=(window.screen.height-iHeight)/2;
 
相关文档:
scrollHeight: 获取对象的滚动高度。
scrollLeft:设置或获取位于对象左边界和窗口中目前可见内容的最左端之间的距离
scrollTop:设置或获取位于对象最顶端和窗口中可见内容的最顶端之间的距离
scrollWidth:获取对象的滚动宽度
offsetHeight:获取对象相对于版面或由父坐标 offsetParent 属性指定的父坐标的高度
offsetL ......
1.日期对象的构造
1.1当前日期
var now = new Date();
1.2特定日期
var someDate = new Date(yyyy,mm,dd);
注:月应该是从0开始计数的.
2. 日期函数的使用可以参照下面的链接. http://www.w3schoo ......
我想使用过ajax的都常见这样的代码:
<a href="javascript:doTest2();void(0);">here</a>
但这儿的void(0)究竟是何含义呢?
Javascript中void是一个操作符,该操作符指定要计算一个表达式但是不返回值。
void 操作符用法格式如下:
1. javascript:void (expression)
2. javascript:void expression
expr ......
var Stack=function(limt_length){
this.stack=new Array();
this.limt=(limt_length)?limt_length:8;
}
Stack.prototype.push=function(o){
if(this.exist(o)){
this.remove(o);
this.stack.unshift(o);
}else{
this.stack.unshift(o);
}
while(t ......