Through jquery to get URL parameters and transcoding, personally feel good, because sometimes do not transcode will have garbled problem.
jquery gets the URL parameter and transcoding, first constructs a regular expression object containing the target parameter, matches the target parameter and returns the parameter value
Code:
<script type= "Text/javascript" >$ (document). Ready (function(){ varPic_url=geturlparam ("Picture");$("#childpic"). attr ("src"), Pic_url); varContent=geturlparam ("Content"); $("#content"). HTML ("<b>" +content+ "</b>"); }); Www.jbxue.comfunctionGeturlparam (name) {//constructs a regular expression object that contains a target parametervarReg =NewRegExp ("(^|&)" + name + "= ([^&]*) (&|$)"); //Match target Parametersvarr = Window.location.search.substr (1). Match (REG); //alert (r);//Return parameter Valuesif(r!=NULL)returndecodeURI (r[2]); return NULL; } </script>
Test url:http://xxxx.html?picture= "xxxx" &content= "Hello!" "