HTML中的target(_self,_blank)用法总结
最近一个项目,多次遇到target='_self', target='_blank'的用法, 再次总结一下:
1.<a>标签
<a href="xxxx" target="_self">XX</a>
<a href="xxxx" target="_blank">XX</a>
2.<form>标签
<form name=alipayment action=alipayapi.jsp method=post target="_blank"> (该代码来自支付宝的demo)
3.window.open
var url =xxxx;
window.open(url,'_self');
(window.location.href=xxx;)
在同一个项目中遇到了target的三种用法。
target的所有取值以及它们的含义:
_blank:在新窗口中打开;
_self:默认。在相同的框架中打开;
_parent:在父框架集中打开;
_top:在整个窗口中打开;
其实我们一般很少用到frameset标签,所以一般我们只是经常用到target='_self' 和 target='_blank',分别用于在当前页面打开,和在一个新的页面打开。
注:
在 HTML 4.01 中,不赞成使用 form 元素的 target 属性;在 XHTML 1.0 Strict DTD 中,不支持该属性。
window.open与window.location.href的区别:
window.open() 用来打开新窗口,但是加上'_self',可以达到使用window.location.href的效果
window.location.href 用来替换当前页,也就是重新定位当前页
window.open() 是可以在一个网站上打开另外的一个网站的地址
而window.location.href 是只能在一个网站中打开本网站的网页
HTML中的target(_self,_blank)用法总结的更多相关文章
- HTML:target=_blank、target=_top、target=_parent、target=_self 的区别
HTML:target=_blank.target=_top.target=_parent.target=_self 的区别 _blank 在新窗口中打开链接_parent 在父窗体中打开链接_sel ...
- html中<a href> </a>的用法
一.绝对跳转 <a href="http://www.baidu.com/">百度</a> 二.相对跳转有如下方式,需要了解(以下的例子中,分别以你的 ...
- html中a标签的常见用法
html中a标签的常见用法 一.总结 一句话总结: a.页面跳转 b.使用锚点定位 c.下载文件 二.html中<a>标签的用法 转自或参考:html中<a>标签的用法http ...
- jquery中attr()与prop()函数用法实例详解(附用法区别)
本文实例讲述了jQuery中attr()与prop()函数用法.分享给大家供大家参考,具体如下: 一.jQuery的attr()方法 jquery中用attr()方法来获取和设置元素属性,attr是a ...
- HTML中的target标记
HTML:target=_blank -- 在新窗口中打开链接 _parent -- 在父窗体中打开链接 _self -- 在当前窗体打开链接,此为默认值 _top -- 在当前窗体打开链接,并替换当 ...
- a标签中的target
html中target四种选择_blank._parent._self._top,分别是什么意思? eg:<Cell title="Open link in new window&qu ...
- 使用<base target="_self" /> IE6 cann't open the Internet site 已终止操作
今日发现一个问题,我的网页需要用到<base target="_self" />,经测试IE8,9 谷歌 火狐全都正常,但是IE6 showModalDialog ...
- Spring mvc中@RequestMapping 6个基本用法
Spring mvc中@RequestMapping 6个基本用法 spring mvc中的@RequestMapping的用法. 1)最基本的,方法级别上应用,例如: Java代码 @Reques ...
- Delphi中stringlist分割字符串的用法
Delphi中stringlist分割字符串的用法 TStrings是一个抽象类,在实际开发中,是除了基本类型外,应用得最多的. 常规的用法大家都知道,现在来讨论它的一些高级的用法. 1.CommaT ...
随机推荐
- LeetCode Verify Preorder Serialization of a Binary Tree
原题链接在这里:https://leetcode.com/problems/verify-preorder-serialization-of-a-binary-tree/ 题目: One way to ...
- linux查看是否被入侵
一.检查系统日志 lastb命令检查系统错误登陆日志,统计IP重试次数 二.检查系统用户 1.cat /etc/passwd查看是否有异常的系统用户 2.grep “0” /etc/passwd查看是 ...
- HtmlAgilityPack抓取搜房网数据简单示例
HtmlAgilityPack是一个开源的解析HTML元素的类库,最大的特点是可以通过XPath来解析HMTL,如果您以前用C#操作过XML,那么使用起HtmlAgilityPack也会得心应手.目前 ...
- Django:使用PyCharm创建django项目并发布到apache2.4
环境: python2.7 x64 win7 x64 django (通过pycharm创建时自动安装)版本:1.10.2 apache:2.4 x64 下载pycharm个人版非社区版本并激活 起初 ...
- 解决 Android SDK下载和更新失败“Connection to https://dl-ssl.google.com refused."
缘由: 更新sdk,遇到了更新下载失败问题: Fetching https://dl-ssl.google.com/android/repository/addons_list-2.xml Fetch ...
- HDU 1258 Sum It Up
Sum It Up Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total S ...
- 【转】SVN管理多个项目版本库
转载地址:http://blog.163.com/zhangxuemin_zy/blog/static/10178565520115704031799/ SVN管理多个项目版本库: 安装SVN服务 ...
- Knights of the Round Table-POJ2942(双连通分量+交叉染色)
Knights of the Round Table Description Being a knight is a very attractive career: searching for the ...
- 【iOS】Foundation框架 学习笔记
1.数组 OC数组不能存放nil值OC数组只能存放OC对象.不能存放非OC对象类型,比如int.struct.enum等 ====================================== ...
- [问题2014S02] 解答
[问题2014S02] 解答 首先注意到: 两个实系数多项式 \(f(x),g(x)\) 互素当且仅当 \(f(x),g(x)\) 在复数域 \(\mathbb{C}\) 上没有共公根, 当且仅当结 ...