Home >Web Front-end >HTML Tutorial >Looking for a function, waiting online! _html/css_WEB-ITnose
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.
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")