欢迎您来到,李雷博客 | PHP博客        登录  |  注册

用window.open在打开网页中接收get方法地址中的参数变量值

更新:2023-06-12 09:31:28
人气:607
来源:本站原创
A+

用html中的方法window.open打开弹出的界面中接收类似于get方法获取地址中的参数变量值。

html中用window.open提交数据:

<script>
	 function open_print(){
	 		prv=$('#num_result').val()
	 		window.open('print.html?v='+prv);
	 }
</script>

html页面中JS接收界面:

<script>
	function GetRequest() {
		var url = location.search; //获取url中"?"符后的字串
		var theRequest = new Object();
		if (url.indexOf("?") != -1) {
			var str = url.substr(1);
			strs = str.split("&");
			for(var i = 0; i < strs.length; i ++) {
				theRequest[strs[i].split("=")[0]] = unescape(strs[i].split("=")[1]);
			}
		}
		return theRequest;
	}
	
	var Request = new Object();
	Request = GetRequest();
	
	print_str= Request['v'];
</script>
推荐的文章
# 发表我的评论
  /     /  
# 最近评论
暂时还没有评论,要不要说点什么?
  Ads by Google
  联系博主
Hello,本博客系统采用PHP和MySql开发,程序开发完全是因为个人爱好,是自己纯手写PHP源代码,未采用任何PHP框架!
QQ:858353007   微信号:lileihot123
网站地图
会员服务
关于我们
QQ:858353007
 
广告服务
加我微信
移动端访问
 
 
Copyright © 2014- 2025 www.mdaima.com All Rights Reserved.
李雷博客,专注PHP经验、PHP教程及PHP源代码开源下载分享的PHP博客!   ICP备案号:京ICP备10202169号-4