Copy codeThe Code is as follows:
Function getObject (objectId ){
If (document. getElementById & document. getElementById (objectId )){
Return document. getElementById (objectId );
} Else if (document. all & document. all (objectId )){
Return document. all (objectId );
} Else if (document. layers & document. layers [objectId]) {
Return document. layers [objectId];
} Else {
Return false;
}
}
Function get (p ){
// Var url = location. search;
Var url = document. URL. toString ();
Var tmpStr = p + "= ";
Var tmp_reg = eval ("/[\? &] "+ TmpStr +"/I ");
If (url. search (tmp_reg) =-1) return null;
Else {
Var a = url. split (/[\? &]/);
For (var I = 0; I <a. length; I ++)
If (a [I]. search (eval ("/^" + tmpStr + "/I "))! =-1) return a [I]. substring (tmpStr. length );
}
}
Window. onload = function (){
GetObject ("key"). value = get ("k ");
// The key is the name in the input, and the received value is the k parameter in the browser.
// K is the parameter name in the browser
}
Put the above Code at the bottom of the html page.