Home >Web Front-end >HTML Tutorial >Looking for a function, waiting online! _html/css_WEB-ITnose

Looking for a function, waiting online! _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:15:131089browse

Page a has an input text box. After inputting, click OK to enter page b. At the same time, the address bar of page b contains the value just entered, that is, http://xxx.com/b.html?set="Just entered of this article" and then display the text in page b, thank you.


Reply to the discussion (solution)

Yours should be a search function, which needs to be combined with a database. It cannot be solved by a simple html page.

What you lose will be displayed, are you not afraid of xss?


function QueryString(str){
var url,num,parStr;
url =location.href;//Current URL
num=url.indexOf("?" );
if(num != -1){//Parameter exists
par = url.substr(num 1);//All parameters
parStr = par.split(str "=")[ 1]//Required parameter values ​​and subsequent parameters
if(parStr != undefined){//Required parameters exist
parStr = parStr.split("&")[0]//Required parameters Value
}
}
alert(parStr)
}
QueryString("set")

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