html中<a>标记的href属性不能正确跳转
来源:互联网 发布:51信用卡管家淘宝认证 编辑:程序博客网 时间:2024/05/16 06:30
可以正常使用的html源码:
<html>
<head>
<script language="javascript">
function clickHandle()
{
try
{
throw new Error(0,"test");
}
catch(tmpE)
{
alert("失败"+tmpE.message);
}
}
function open_window(){
window.open("","","channelmode=yes,fullscreen=yes");
}
</script>
</head>
<body>
<input type="button" value="click" onclick="clickHandle()"/>
<input type="button" value="open window" onclick="open_window()"/>
<a href="javascript:void window.open('http://www.sina.com.cn/','XX',' left=0,top=0,width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no')">Open</a>
</body>
</html>
不能正确跳转的html源码
<html>
<head>
<script language="javascript">
function clickHandle()
{
try
{
throw new Error(0,"test");
}
catch(tmpE)
{
alert("失败"+tmpE.message);
}
}
function open_window(){
window.open("","","channelmode=yes,fullscreen=yes");
}
</script>
<base target="frmContent" />
</head>
<body>
<input type="button" value="click" onclick="clickHandle()"/>
<input type="button" value="open window" onclick="open_window()"/>
<a href="javascript:void window.open('http://www.sina.com.cn/','XX',' left=0,top=0,width='+ (screen.availWidth - 10) +',height='+ (screen.availHeight-50) +',scrollbars,resizable=yes,toolbar=no')">Open</a>
</body>
</html>
通过比较代码可以看到问题出在<base>标记上,如果加上,则href属性指定的代码不能被正确解释执行,去掉后则可以
HTML DOM Base 对象
Base 对象
Base 对象代表 HTML 的 base 元素。
在 HTML 文档中 <base> 每出现一次,Base 对象就会被创建。
Base 对象属性
通过上面的描述可以知道,如果设置了页面的<base>的target属性,则在打开<a>的href连接时,将会在target指定的框架中打开,除非你
设置了<a>标记的target属性;
但是一般我们通过脚本在新窗口中打开连接的时候是不会再设置target属性的,而且你一旦决定用脚本打开窗口去打开连接,也不可以再用target属性了
否则、就会想<base>的target一样的效果了。
- html中<a>标记的href属性不能正确跳转
- JS控制A标记的href跳转
- JS控制A标记的href跳转
- js中a标签的href属性不跳转方法
- HTML:a标签中href属性总结
- 【HTML】<a>标签href属性不跳转问题
- HTML <a> 标签的 href 属性
- HTML <a> 标签的 href 属性
- HTML <a> 标签的 href 属性
- JS 超链接标记 a 的 href 属性 与
- html中<a href> </a>的用法
- html中<a href> </a>的用法
- javascript 超链接标记 a 的 href="#", href="javascript:void(0)" 属性
- A href中target属性的用法
- html标记<a/>属性href, onclick执行顺序与失效问题解决
- html 中a标签中href属性 加#号和不加#号的区别
- MyEclipse中不能提示JSP页面的html标记属性值?
- MyEclipse中不能提示JSP页面的html标记属性值?
- 图像相似度检测之直方图相交
- Binary Search Tree Iterator
- 基于视频深度学习的人物行为识别 资料汇总
- IOS uiwebview中加载服务器上的html图片不显示
- java关键字梳理
- html中<a>标记的href属性不能正确跳转
- Matlab常用函数流水账
- myeclipse导入工程报错问题
- 分享 APP竞品分析的几个工具
- java用到的各类容器_待
- 设计模式的学习总结
- 每日刷题(2015/6/24):Find the mistake(s) in the following co
- Oracle11完全卸载方法
- DAG模型硬币问题