最新更新 sitemap 网站制作设计本站搜索
网页设计
国外网站 韩国网站 个人主页 手提袋设计 CSS 网页特效 平面设计 网站设计 Flash CMS技巧 服装网站 php教程 photoshop 画册 服务器选用 数据库 Office
虚拟主机 域名注册 云主机 网页设计 客服QQ:8208442
当前位置:首页 > 编程开发 > asp教程

asp教程:jQuery初探

日期:08-06    来源:中国设计秀    作者:cnwebshow.com

可能老赵很反感IE6,所以他在自己的博客里面做了点手脚,如果是IE6浏览他的博客的话,那么就会跳转到另一个页面。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  很郁闷,看个博客吗,还要在安装一个浏览器?俺很懒,俺就是想要用IE6看!otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  最近在看jQuery,刚刚入一点门,发现了一个有趣的函数,就拿老赵的博客做实验了,哈。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  otc中国设计秀
otc中国设计秀
装入一个 HTML 网页最新版本。 otc中国设计秀
otc中国设计秀
jQuery 代码:otc中国设计秀
otc中国设计秀
$.Ajax({otc中国设计秀
  url: "test.html",otc中国设计秀
  cache: false,otc中国设计秀
  success: function(html){otc中国设计秀
    $("#results").append(html);otc中国设计秀
  }otc中国设计秀
}); otc中国设计秀
otc中国设计秀
<div id="results"></div>otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  就用这个了,把地址换成老赵的博客,看看会有什么效果,嘻嘻。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  新建一个文本文件,改名为:a.htm。照猫画虎,copy进去例子里的代码,改URL,运行。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  看到了,哈,等等,怎么又跳转了?看来博客里面的js脚本也运行了。找,把那段脚本干掉不就ok了吗。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  找了半天(js比较烂),终于找到了。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
代码 otc中国设计秀
<!--[if IE 6]>otc中国设计秀
<script language="javascript" type="text/Javascript">otc中国设计秀
var url = window.location.toString();otc中国设计秀
window.location = "http://files.cnblogs.com/JeffreyZhao/no-ie6.xml?r=" + Math.random().toString() + "&from=" + encodeURIComponent(url);otc中国设计秀
</script>otc中国设计秀
<![endif]-->otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  就是这段代码在捣乱,干掉。replace掉“window.location……就可以了。 otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
代码 otc中国设计秀
otc中国设计秀
<head><title>用IE6看老赵的博客v1.0</title>otc中国设计秀
    <script src="aspnet_client/jquery/jquery-1.3.1.js" type="text/javascript"></script>otc中国设计秀
    <script type="text/javascript">otc中国设计秀
    //等待dom元素加载完毕.otc中国设计秀
    $(document).ready(function(){    otc中国设计秀
      $.ajax({otc中国设计秀
      url: "http://www.cnblogs.com/JeffreyZhao/archive/2010/01/14/talk-about-code-performance-4-asm-optimization.html",otc中国设计秀
      cache: false,otc中国设计秀
      success: function(html){otc中国设计秀
         otc中国设计秀
            html = html.replace("window.location = "http://files.cnblogs.com/JeffreyZhao/no-ie6.xml?r=" + Math.random().toString() + "&from=" + encodeURIComponent(url);","");otc中国设计秀
            $("#results").append(html);  otc中国设计秀
          }otc中国设计秀
       });otc中国设计秀
    otc中国设计秀
     });otc中国设计秀
</script>otc中国设计秀
</head>otc中国设计秀
<body>otc中国设计秀
    otc中国设计秀
    <div id="results"></div>otc中国设计秀
   otc中国设计秀
</body>otc中国设计秀
</html>otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
  代码就是这样了,在本地建立一个文本文件,改名,copy,运行。然后IE6里面就可以看到老赵的博客了。otc中国设计秀
otc中国设计秀
otc中国设计秀
otc中国设计秀
ps:在网站里运行这段代码,居然说“没有权限”。所以就不能在线演示了。otc中国设计秀
otc中国设计秀
 otc中国设计秀

本文引用地址:/bc/article_46141.html
网站地图 | 关于我们 | 联系我们 | 网站建设 | 广告服务 | 版权声明 | 免责声明