转载:分享:A 标签中的target用js实现链接 百度空间_应用平台

Target Window or Frame

clr gif
Join the Discussion

Questions? Comments?

With an ordinary HTML link using the <a> tag you can target the page that the link refers to so that it will display in another window or frame. Of course the same can also be done from within Javascript.

To target the top of the current page and break out of any frameset currently in use you would use <a href="page.htm" target="_top"> in HTML. In Javascript you use:

top.location.href = 'page.htm';

To target the current page or frame you can use <a href="page.htm" target="_self"> in HTML. In Javascript you use:

self.location.href = 'page.htm';

To target the parent frame you can use <a href="page.htm" target="_parent"> in HTML. In Javascript you use:

parent.location.href = 'page.htm';

To target a specific frame within a frameset you can use <a href="page.htm" target="thatframe"> in HTML. In Javascript you use:

top.frames['thatframe'].location.href = 'page.htm';

To target a specific iframe within the current page you can use <a href="page.htm" target="thatframe"> in HTML. In Javascript you use:

self.frames['thatframe'].location.href = 'page.htm';
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值