js 页面跳转怎么实现target js 怎么在document.location.href中用...
js\u9875\u9762\u8df3\u8f6c \u5b9e\u73b0\u76f8\u5f53\u4e8ea\u6807\u7b7e\u7684target=_black
var f=document.createElement("form");
f.action="http://www.baidu.com";
f.target="_blank";
f.method="get";
document.body.appendChild(f);
f.submit();
\u4e0d\u628aform\u653e\u5230\u9875\u9762\u4e0a\u4f3c\u4e4e\u4e0d\u80fd\u63d0\u4ea4\u554a
js\u7684location.href\u9ed8\u8ba4\u662f\u672c\u9875\u9762\u91cd\u5b9a\u5411\u7f51\u5740\u7684\u54e6\uff0c\u6ca1\u529e\u6cd5target\u65b0\u7a97\u53e3\u8df3\u8f6c\uff0c\u8981\u65b0\u7a97\u53e3\u8df3\u8f6c\u8bf7\u4f7f\u7528window.open\u5177\u4f53\u4ee3\u7801\u5982\u4e0b
javascript:window.open("http://www.baidu.com","_blank")\u3002\u3002\u3002\u4f60\u53ef\u4ee5copy\u672c\u5730\u8bd5\u8bd5~~~~
代码如下:
1.跳出框架,在父页面。
jsp:
<script language="javascript">
window.parent.frames.location.href="../welcome.en"
</script>
java:
PrintWriter out = response.getWriter();
out.write("<script type='text/javascript'>window.parent.frames.location.href = '../welcome.en';</script>");
return;
2.从一个框架跳转到 name="main" 的框架里。
<script language="javascript">
var key = document.getElementById(" ## ").value;
window.parent.main .location.href= "welcome.en ? key=" + key;
</script>
3.ContentList 当前页的iframe名字
window.ContentList.location.href = '../welcome.en';
后台应该用的是frameset框架,那么写js的时候就先找到顶层窗口 top ,然后找到下属的窗口(对应要变化的frame元素),然后改变frame元素的src属性就达到了跳转的功能。
扩展阅读:跳转进入 ... 浏览器怎么打开链接 ... javascript在线 ... 为什么老跳转js96110 ... js 点击事件页面跳转 ... js 跳转到登录页面代码 ... js做一个登录成功跳转页面 ... js themeleaf 页面跳转 ... js实现页面跳转的几种方法 ...