|
|
||||
首页
文学作品 网页设计 平面设计 程序设计 考试认证 基础办公 QQ资源 服务器架设 网站运营 网页资源
|
|
|
| 汉南在线 → 网页设计 → JavaScript脚本 | |||||||||||
JavaScript脚本: window.onload = function() { var links = document.getElementsByTagName('a'); for (var i=0;i < links.length;i++) { if (links[i].className == 'new-window') { links[i].onclick = function() { window.open(this.href); return false; }; } } }; 或更简洁的JQuery: $(function(){ $('a.new-window').click(function(){ window.open(this.href); return false; }); }); 然后在想要以新窗口打开的链接处添加 class="new-window".
| |||||||||||
| >> 相关文章 | |||||||||||
|
授权使用:汉南在线 http://www.hzwz.net/(2008-2009) Copyright (c) 2002-2007 汉南在线. All Rights Reserved . 经营许可证:陕ICP备05000109号 Powered by:汉南在线 |