javascript 中的target怎么用?有什么用法?

卡纳瓦咯 2005-12-12 11:32:12
如题。
...全文
970 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
chouchy 2005-12-12
  • 打赏
  • 举报
回复
描述:
指定显示内容的窗口或者帧。

语法:
object.target[ = target]

注释
如果没有与指定的名称相匹配的窗口或者帧,浏览器将打开一个新窗口,以下部分不翻译

The default value for target depends upon the URL and site. If the user does not leave the site, the default is _self, but if the user exits to a new site, the default is _top.

Special Target Values _blank Specifies to load the link into a new blank window. This window is not named.
_parent Specifies to load the link into the immediate parent of the document the link is in.
_self Specifies to load the link into the same window the link was clicked in.
_top Specifies to load the link into the full body of the window.


This property has read-write permissions, meaning you can change as well as retrieve its current value.

应用于下列html标签中

A, AREA, BASE, FORM

卡纳瓦咯 2005-12-12
  • 打赏
  • 举报
回复
window.open()没明白,小虎说的什么意思?
tigerwen01 2005-12-12
  • 打赏
  • 举报
回复
使用window.open()
卡纳瓦咯 2005-12-12
  • 打赏
  • 举报
回复
<a href="http://www.google.com" id="aaa">aaaa</a>
<a href="http://www.google.com" id="bbb">bbbb</a>
<script>
document.getElementById("bbb").target = "_blank";
</script>
这里的document.getElementById("bbb").target = "_blank";我可以随便指定吗?还是“_blank”应该是某个页面的title或者拿个属性?
rainxiang 2005-12-12
  • 打赏
  • 举报
回复
<a href="http://www.google.com" id="aaa">aaaa</a>
<a href="http://www.google.com" id="bbb">bbbb</a>
<script>
document.getElementById("bbb").target = "_blank";
</script>

87,993

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧