Ajax 强制刷新页面 By shawl.qiu
来源:互联网 发布:知乎论坛注册 编辑:程序博客网 时间:2024/05/06 01:25
Ajax 强制刷新页面 By shawl.qiu
说明:没啥好说明的, 没了解 Ajax 之前, 很有一种神秘感, 了解后...好像觉着,有点过于简单了.
主要使用的还不就是无刷新的 get 与 post.
不过对于 Ajax , 令人头疼的是, 为什么会有好多种不同的浏览器.
而这些浏览器浏览网页时又有不少属于各自的属性方法.
但每个浏览器一推出新版本, 又会更好的兼容其他的浏览器, 但随着而来的是,
该新版本的浏览器又会有自己的新方法, 这简直就是一个做不完的梦.
好了, 啰嗦完了, 说重点.
本文只能实现 IE & Firefox 的强制刷新页面, 且只能刷新一个特定文件.
另, Firefox 不用设置啥就可强制刷新页面.
但对于 Opera, 我是没办法了, 去官网的 UserJs 查了一叠叠文章, 找不着可行方法...
shawl.qiu
2006-10-28
http://blog.csdn.net/btbtd/
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <!-- DW6 -->
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>shawl.qiu template</title>
- <script type="text/javascript">
- //<![CDATA[
- var XMLHTTP={
- //-----------------------------------begin request
- request:function(){
- try{
- return new XMLHttpRequest();
- } catch(e) {
- try{
- return new ActiveXObject('microsoft.xmlhttp');
- } catch(e){
- try{
- return new ActiveXObject("Msxml2.XMLHTTP");
- } catch(e){}
- }
- }
- },
- //-----------------------------------end request
- // begin text
- text:function(method, url, func){
- var request=XMLHTTP.request();
- request.open(method, url);
- request.onreadystatechange=function(){
- if(request.readyState==4&&request.status==200){
- if(func) func(request.responseText);
- else alert(request.responseText);
- }
- }
- request.send(null);
- },
- //-----------------------------------end text
- // begin reload
- reload:function(method, url){
- if(navigator.appName!='Netscape'){
- var request=XMLHTTP.request();
- request.open(method, url, true);
- try{ w.close(); } catch(e){}
- w=open('','');
- w.blur();
- w.opener.focus();
- request.onreadystatechange=function(){
- if(request.readyState==4&&request.status==200){
- w.close();
- location.reload(true);
- }
- }
- request.send(null);
- } else location.reload(true);
- }
- //-----------------------------------end reload
- } // shawl.qiu script
- //----------------------------------------end object XMLHTTP ----------------------------//
- onload=function(){ // 加载 sqEditor 按钮, 请以绝对地址加载.
- XMLHTTP.text('GET', 'sqEditor/sqEditorMarkupList.htm', fGetMarkupList);
- }
- function fGetMarkupList(obj){
- var o=document.getElementById('sqEditor');
- o.innerHTML=obj;
- } // shawl.qiu script
- //]]>
- </script>
- </head>
- <body>
- <div id="sqEditor"></div><!--显示 iframe 标签列表-->
- <br/><button onclick="XMLHTTP.reload('GET', 'sqEditor/sqEditorMarkupList.htm');">reload</button>
- </body>
- </html>
- Ajax 强制刷新页面 By shawl.qiu
- 关闭Modem拔号音 By Shawl.qiu
- ASP 初阶笔记 By Shawl.qiu
- js prototype 格式化数字 By shawl.qiu
- Javascript prototype 格式化日期 By shawl.qiu
- Javascript 读写 Cookie 操作 By shawl.qiu
- ASCII 输入模板 By shawl.qiu
- xml dtd 学习小结 By shawl.qiu
- Javascript 中模拟 Enum By shawl.qiu
- 使用 javascript 函数 完美控制页面图片显示大小 By shawl.qiu
- 使用 javascript HTML DOM 高亮显示页面特定字词 By shawl.qiu
- 使用 javascript 函数 完美控制页面图片显示大小(第二版) By shawl.qiu
- CMD 查看进程与结束进程 By Shawl.qiu
- cmd 方式使用 Search and Replace 例 By shawl.qiu
- ASP VBScript 动态包含文件, FSO 实现 By Shawl.qiu
- CSS 弹出菜单, 完美实现, 完美兼容 By shawl.qiu
- Javascript 函数: CTRL+回车 提交表单 By shawl.qiu
- ASP 优化之显示数据查询内容 By shawl.qiu
- 无题
- 在b/s开发中经常用到的javaScript技术
- 出发吧!
- 权限设计的探讨 (转)
- 面试表现失水准,郁闷!
- Ajax 强制刷新页面 By shawl.qiu
- Blog搬家
- 正则表达式
- 谁能在GEAR OF WAR里看到软阴影?
- 2005岁末BLOG程序大评点
- 以前几篇哦
- 2006最酷小说《上上床,谈谈心》
- 我的博客
- 第三次上机实验的程序设计思路分析及解答