`
shoushounihao
  • 浏览: 39344 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

window.location.href解决target问题

 
阅读更多

 

/*

 

  window.open()是可以在一个网站上打开另外的一个网站的地址

而window.location()是只能在一个网站中打开本网站的网页

*/

 

3个页面

1 index.html

Html代码 复制代码 收藏代码window.location.href解决target问题
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  5. <title>无标题文档</title>
  6. </head>
  7. <frameset rows="*" cols="241,*" framespacing="0" frameborder="NO" border="0">
  8. <frame src="UntitledFrame-2.htm" id="leftFrame" name="leftFrame" scrolling="NO" noresize>
  9. <frame src="Untitled-1.htm" id="rigthmain" name="rigthmain">
  10. </frameset>
  11. <noframes><body>
  12. </body></noframes>
  13. </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <frameset rows="*" cols="241,*" framespacing="0" frameborder="NO" border="0"> <frame src="UntitledFrame-2.htm" id="leftFrame" name="leftFrame" scrolling="NO" noresize> <frame src="Untitled-1.htm" id="rigthmain" name="rigthmain"> </frameset> <noframes><body> </body></noframes> </html>

2 Untitled-1.htm

Html代码 复制代码 收藏代码window.location.href解决target问题
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  6. <title>显示页面</title>
  7. </head>
  8. <body>
  9. welcme to you</body>
  10. </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <body> dasssssssssssssssssssssss </body> </html>

3 UntitledFrame-2.htm

Html代码 复制代码 收藏代码window.location.href解决target问题
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
  2. "http://www.w3.org/TR/html4/loose.dtd">
  3. <html>
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  6. <title>无标题文档</title>
  7. </head>
  8. <script>
  9. function aa(){
  10. window.parent.rigthmain.location.href="http://www.baidu.com";
  11. }
  12. </script>
  13. <body>
  14. <a onClick=" aa()">a</a>
  15. </body>
  16. </html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head> <script> function aa(){ window.parent.rigthmain.location.href="http://www.baidu.com"; } </script> <body> <a onClick=" aa()">a</a> </body> </html>

重点解析

window.parent.rigthmain.location.href="http://www.baidu.com";
parent取父框架

rigthmain去子框架

分享到:
评论

相关推荐

    ie与session丢失(新窗口cookie丢失)实测及解决方案

    今天在一个群中有人问到ie6中使用js的open,发现新窗口中并获取不到session, 经过使用下面的测试代码测试发现,是因为phpsessionid储存是进程级的有效期,只有同一进程才能获取得到,很多人说,open后或是target=”_blank...

    javascript小技巧

    var message='&lt;b&gt;&lt;font size=5 face=arial color=red&gt;&lt;a href="#" target="_blank"&gt;请点击进入本站&lt;/a&gt;&lt;/font&gt;&lt;/b&gt;' //背景色 var backgroundcolor="#eeffee" //0 代表信息永远显示,1 代表信息只显示一段时间,2...

    js 有框架页面跳转(target)三种情况下的应用

    jsp: 代码如下: [removed] window.parent.frames.location.href=”../welcome.en” [removed] java: 代码如下: PrintWriter out = response.getWriter(); out.write(“[removed]window.parent.frames.location.href...

    一个简单的网页框架 frame

    &lt;noframes &gt; 请使用支持 frame 的浏览器或者访问 &lt;a href= "/Tree/SiteMap.htm " target= "_blank "&gt; CSDN 社区地图 &lt;/a&gt; &lt;/noframes&gt; ...

    js使用小技巧

    &lt;body onload="window.resizeTo(window.screen.width - 4,window.screen.height-50);window.moveTo(-4,-4)"&gt; 无关闭按钮IE window.open("aa.htm", "meizz", "fullscreen=7"); 统一编码/解码 alert...

    浮点vfdsfJAVA实现链表,双向链表.txtJAVA实现链表,双向链表.txt

    &lt;li&gt;&lt;input id="cb_agree" name="cb_agree" type="checkbox" value="" /&gt;同意&lt;a href="http://download.csdn.net/help" target="_blank"&gt;CSDN资源上传协议&lt;/a&gt;&lt;/label&gt; 验证码: ...

    ASP.NET程序中常用的三十三种代码.txt

     e.item.Attributes.Add("ondblclick", "location.href=’../ShippedGrid.aspx?id=" + OrderItemID + "’"); }  双击表格打开新一页 if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ...

    ASP.Net电子商务网站后台模板

    &lt;a href="javascript:window.location.reload()" target="content3"&gt;隐藏工作台&lt;/a&gt;&nbsp;&nbsp;|&nbsp;&nbsp; &lt;a href="javascript:window.location.reload()" target="content3"&gt;管理首页&lt;/a&gt;&nbsp;&nbsp;|&nbsp...

    ASP.NET常用代码

    e.item.Attributes.Add("ondblclick", "location.href='../ShippedGrid.aspx?id=" + OrderItemID + "'"); } 双击表格打开新一页 if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType....

    js+html滑出式菜单

    WIDTH="100%"&gt;&lt;FONT face="'+linkFontFamily+'" Size="'+linkFontSize+'"&gt; &lt;A HREF="'+link+'" target="'+target+'" CLASS="ssm2Items"&gt;'+text+'&lt;/A&gt;&lt;/FONT&gt;&lt;/LAYER&gt;&lt;/ILAYER&gt;&lt;/TD&gt;&lt;/TR&gt;')} function addHdr(text) ...

    wayos认证页面

    alert(msg.msg)}}function get_ld(){var tmp=window.location.href.split("ld=");if(tmp.length==2){return tmp[1]}return""}var ld="";var init=0;$(function(){ld=get_ld();var get_val=getCookie("save");if(get_...

    登录页面源码

    -- Brand and toggle get grouped for better mobile display --&gt;&lt;div class="navbar-header"&gt;&lt;button type="button" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" class="navbar-toggle"&gt;...

    08内存及存储管理(下)

    void(keyit=window.open('http://www.365key.com/storeit.aspx?t='+escape(d.title)+'&u='+escape(d.location.href)+'&c='+escape(t),'keyit','scrollbars=no,width=475,height=575,left=75,top=20,status=no,...

    三星9305收索

    &lt;!...--STATUS OK--&gt;&lt;html&gt;&lt;head&gt;;charset=utf-8"&gt;&lt;meta http-equiv="X-UA-Compatible" content="IE=Edge"&gt;&lt;link rel="dns-prefetch" href="//s1.bdstatic...._position:;min-height:100%}#head{padding-bottom:100px;...

    。NET经典技术

     e.item.Attributes.Add("ondblclick", "location.href='../ShippedGrid.aspx?id=" + orderItemID + "'");  }  双击表格打开新一页  if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ...

    selenium怎样在多窗口中运行程序 (1)

    (2)name:例:&lt;a target="selenium_blank60273" href="http://bbs.51testing.com/"&gt;软件测试论坛,则selectWindow name='selenium_blank60273' (3)var 25.录制完成之后,经常会出现回放不成功的情况,在这种...

    圣诞节 祝福网站 全部源码

    创意支持:&lt;a href="http://www.efangbbs.com" target="_blank"&gt;西安工程大学艺纺论坛&lt;/a&gt; &lt;a href="http://www.mutoulee.cn" target="_blank"&gt;体无完肤&lt;/a&gt;&lt;br /&gt; ; left:0px; top:0px; z-index:99; ...

    ExtAspNet v2.2.1 (2009-4-1) 值得一看

    -Window的Target属性由字符串类型变为枚举类型,注意更新以前的代码:Target="_self" -&gt; Target="Self", Target="_parent" -&gt; Target="Parent"。 -MenuButton, LinkButton, Button, LinkButtonField的...

    ExtAspNet_v2.3.2_dll

    -Window的Target属性由字符串类型变为枚举类型,注意更新以前的代码:Target="_self" -&gt; Target="Self", Target="_parent" -&gt; Target="Parent"。 -MenuButton, LinkButton, Button, LinkButtonField的...

    asp连接数据库代码实例

    location.href(\'index.asp\');&lt;/script&gt;\" end if %&gt; -------------------------------------- 3.显示记录 set rs=server.createobject(\"adodb.recordset\") sql=\"select * from biao order by id desc...

Global site tag (gtag.js) - Google Analytics