Home >Web Front-end >HTML Tutorial >Passing parameters between HTML pages_html/css_WEB-ITnose

Passing parameters between HTML pages_html/css_WEB-ITnose

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-24 11:49:141286browse

Pass the url parameters from page one to page two:

window.location.href="./page2.html?content="+encodeURI(encodeURI(userText))+"&name="+encodeURI(encodeURI(name));	

Page two gets the url parameters in s:

		var rf = document.referrer;		//获取url参数		function getQueryString(name) {			var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");			var r = window.location.search.substr(1).match(reg);			if (r != null)				return unescape(r[2]);			return null;		}		var name = decodeURI(getQueryString('name'));		var content = decodeURI(getQueryString('content'));


My personal blog: http://blog.caicongyang.com;

My personal website: http://www.caicongyang.com;

My CSDN blog address:



Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn