让iframe子窗体取父窗体地址栏参数(querystring)
作者:bea
代码如下: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>让iframe子窗体取父窗体地址栏参数(querystring)</title> <script type="text/javascript"> function f(){ //http://localhost:4101/MyFiles/netshop/ShopType.asp
代码如下:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>让iframe子窗体取父窗体地址栏参数(querystring)</title>
<script type="text/javascript">
function f(){
//http://localhost:4101/MyFiles/netshop/ShopType.aspx?tid=1
var url = window.location.href;//取得地址栏
var pos = url.indexOf("tid");//简单做个字符串处理,这里只有一个参数。
var tid = url.substring(pos+4);//取tid=后面的字符串,所以+4
document.getElementById("gv_frame").src = "ShopType.aspx?tid=" + tid;
}
</script>
</head>
<body onload="f();">
<iframe id="gv_frame"></iframe>
</body>
</html>
有用 | 无用
猜你喜欢
您可能感兴趣的文章:
- JavaScript 替换Html标签实现代码
- JavaScript null和undefined区别分析
- JavaScript iframe的相互操作浅析
- jQuery入门 构造函数
- 使用jQuery简化Ajax开发 Ajax开发入门
- jQuery技巧大放送 学习jquery的朋友可以看下
- Jquery 学习笔记(二)
- ie与firefox下的event使用说明与详细区别
- JS+XML 省份和城市之间的联动实现代码
- jquery 常用操作整理 基础入门篇
- 一些技巧性实用js代码小结
- Jquery 学习笔记(一)
- extjs 学习笔记(二) Ext.Element类
- extjs 学习笔记(一) 一些基础知识
- javascript 变速加数功能实现代码
- JQuery 绑定事件时传递参数的实现方法
- 通用javascript脚本函数库 方便开发
- jQuery与javascript对照学习 获取父子前后元素 实现代码
- jquery pagination插件实现无刷新分页代码