不用css而用js控制div层内链接在新窗口打开解决方案
feilong.org 修订于2008-04-07 07:49:24 您好,第 333 位朋友!大家知道,让整个网页页面内的链接都在新窗口打开的方法,在head中加入
<base target="_blank"> |
这是用html专用标签做的,但是一个网页所有链接都新窗口打开,飞龙认为是很不明智的。
1、经飞龙验证,用js控制某个具体的链接在新窗口打开,而且可以控制窗口的大小位置滚动条菜单栏,这个很适合视频播放器或音频播放器页面。
飞龙整理的js链接打开新窗口的网页代码如下:
<!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"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>飞龙js控制链接在新窗口打开</title> <script type="text/javascript"> <!-- function openwindow(url){ window.open(url,"","toolbar=no,status=no,menubar=no,location=no,height=500,width=500,scrollbars=yes"); } --> </script> </head> <body> <a href="http://feilong.org" title="feilong.org" onclick="openwindow(this.href);return false">飞龙博客 为你解忧</a> </body> </html> |
2、那么某个特定id范围内的链接在新窗口打开呢?比如某个div内的所有链接在新窗口打开。
尚待研究呵呵。
更新网址:https://feilong.org/links-page-div-open-blank
最初发布:20080407 07:49:24 feilong.org 于广州
加入收藏夹,查看更方便。
所在分类: 网站开发