iframe中页面跳转之后如何获取父窗口

iframe中页面跳转之后如何获取父窗口,第1张

输出脚本

C# codestring js = "<script>windowparentlocationhref='页面URL';</script>";

ClientScriptRegisterClientScriptBlock(thisGetType(), "myJS", js);

或者

JScript codewindowparentlocationhref='';Javascript刷新页面的几种方法:

1    historygo(0)

2    windowlocationreload()

     windowlocationreload(true)

3    location=location

4    locationassign(location)

5    documentexecCommand(''Refresh'')

6    windownavigate(location)

7    locationreplace(location)

8    documentURL=locationhref

  

Frame框架:

framehtml:

<frameset rows="50%,50%">

       <frame name=top src="tophtml">

       <frame name=bottom src="bottomhtml">

    </frameset>

七种语句

语句1 windowparentframes[1]locationreload();

    语句2 windowparentframesbottomlocationreload();

    语句3 windowparentframes["bottom"]locationreload();

    语句4 windowparentframesitem(1)locationreload();

    语句5 windowparentframesitem(''bottom'')locationreload();

    语句6 windowparentbottomlocationreload();

    语句7 windowparent[''bottom'']locationreload();

  

tophtml 页面的代码如下:

<input type=button value="刷新1" onclick="windowparentframes[1]locationreload()">

  

bottomhtml页面:

<body onload="alert(''我被加载了!'')">

      <h1>This is the content in bottomhtml</h1>

    </body>

  

1window指代的是当前页面,例如对于此例它指的是tophtml页面。

    2parent指的是当前页面的父页面,也就是包含它的框架页面。例如对于此例它指的是framehtml。

    3frames是window对象,是一个数组。代表着该框架内所有子页面。

    4item是方法。返回数组里面的元素。

    5如果子页面也是个框架页面,里面还是其它的子页面,那么上面的有些方法可能不行。

  

如果想关闭窗口时刷新或者想开窗时刷新的话,在<body>中调用以下语句即可。

<body onload="openerlocationreload()"> 开窗时刷新

    <body onUnload="openerlocationreload()"> 关闭时刷新

  

//子窗口刷新父窗口

<script language=JavaScript>

    selfopenerlocationreload();

</script>

( 或 <a href="javascript:openerlocationreload()">刷新</a>   )

关闭当前页面A,然后跳转到下一个Activity B即可。

Afinish();

Intent intentToG0=new Intent(Athis,Bclass);

startActivity(intentToGo);

获取jsp页面参数的方式,要看这个jsp页面是以什么方式传递参数的。

一般的,一个jsp页面通过以下方式传递参数:

在form表单中添加参数;

如:<form action="resultjsp" method="get" align="center">

<input type="text" name="name">

</from>

在sesseion、request的attribute中添加参数

如:sessionsetAttribute("name","百度"); // 第一个参数是名,第二个参数是值

在超链接后面添加参数

如:<a herf="resultjsp"name="百度"</a>

通过<jsp:param>添加参数

如:<jsp:forward page="resultjsp">            <jsp:param name="name" value="百度"/>        </jsp:forward>

对于以上的4种传递参数的方式,第1,3,4种都可以用equestgetParameter("name") 的方式来获取参数的值,而对第2种方式,可以用sessiongetAttribute("name")或者requestgetAttribute("name")的方式获取参数的值

写到URL里?用GET?

testhtml

<META content=2;url=test2phpurl=test2php >

实现方法:

一:获取URL带QUESTRING参数的JAVASCRIPT客户端解决方案,相当于asp的requestquerystring,PHP的$_GET

1函数:

<Script language="javascript">

function GetRequest() {

var url = locationsearch; //获取url中""符后的字串

var theRequest = new Object();

if (urlindexOf("") != -1) {

var str = urlsubstr(1);

strs = strsplit("&");

for(var i = 0; i < strslength; i ++) {

theRequest[strs[i]split("=")[0]]=(strs[i]split("=")[1]);

}

}

return theRequest;

}

</Script>

2然后通过调用此函数获取对应参数值:

<Script language="javascript">

var Request = new Object();

Request = GetRequest();

var 参数1,参数2,参数3,参数N;

参数1 = Request[''参数1''];

参数2 = Request[''参数2''];

参数3 = Request[''参数3''];

参数N = Request[''参数N''];

</Script>

以此获取url串中所带的同名参数

二、正则分析法。

function GetQueryString(name) {

var reg = new

RegExp("(^|&)" + name +

"=([^&])(&|$)","i");

var r =

windowlocationsearchsubstr(1)match(reg);

if (r!=null) return

(r[2]); return null;

}

alert(GetQueryString("参数名1"));

alert(GetQueryString("参数名2"));

alert(GetQueryString("参数名3"));

其他参数获取介绍:

//设置或获取对象指定的文件名或路径。

alert(windowlocationpathname);

//设置或获取整个 URL

为字符串。

alert(windowlocationhref);

//设置或获取与 URL

关联的端口号码。

alert(windowlocationport);

//设置或获取 URL

的协议部分。

alert(windowlocationprotocol);

//设置或获取 href

属性中在井号“#”后面的分段。

alert(windowlocationhash);

//设置或获取 location 或 URL 的

hostname 和 port 号码。

alert(windowlocationhost);

//设置或获取 href

属性中跟在问号后面的部分。

alert(windowlocationsearch);

以上就是关于iframe中页面跳转之后如何获取父窗口全部的内容,包括:iframe中页面跳转之后如何获取父窗口、android登陆时如何获取登录名并将其显示在跳转后的页面上、jsp页面跳转后,如何获取前面一个页面的一个参数值等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/9394047.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-04-27
下一篇2023-04-27

发表评论

登录后才能评论

评论列表(0条)

    保存