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;
 
相关文档:
1.日期对象的构造
1.1当前日期
var now = new Date();
1.2特定日期
var someDate = new Date(yyyy,mm,dd);
注:月应该是从0开始计数的.
2. 日期函数的使用可以参照下面的链接. http://www.w3schoo ......
JavaScript方法和技巧大全 基础知识
1 创建脚本块 <script language=”JavaScript”> JavaScript code goes here </script>
2 隐藏脚本代码 <script language=”JavaScript”><!-- document.write(“Hello”); --> </script>
在不支持 ......
css获取页面中心位置
.fixed
{
FONT-SIZE: 30pt;
color : #1A6841;
left:expression(eval(document.body.clientWidth)/2-150);
top:expression(eval(document.body.clientHeight)/2-25);
width:300px;
height:50px;
border:green 1px solid;
background:#99CCFF;
+position:absolute;
+left:expression(ev ......
今天偶然间看到一段JS代码:
......
<mce:script for="t" event="onclick"><!--
alert('hello');
// --></mce:script>
......
<a href="#" mce_href="#" id="t" ></a> hello </a>
.....
这是什么写法?
查了下W3C的 ......
<script language="javascript">
<!--
String.prototype.replaceAll = stringReplaceAll;
function stringReplaceAll(AFindText,ARepText){
raRegExp = new RegExp(AFindText,"g");
return this.replace(raRegExp,ARepText)
}
var content = "%sfasf%sfd%asdfsadf%1111%"
// 把 所有的 % 替换为 #
......