<script>varurl = "http://127.0.0.1/index.php?old_quantity=168&date=1478309879000$id=2";//Defining Variables functionParse_url (_url) {//Defining Functions varPattern =/(\w+) = (\w+)/ig;//Defining Regular Expressions varParames = {};//Defining ArraysUrl.replace (Pattern,function(A, B, c) {Parames[b]=C; }); /*This is the most critical. When replace matches to date=1478309879000. Then use the Execute function (a,b,c), where A is the value: Date=1478309879000,b is the value of date, The value of C is 1478309879000; (this is a reverse reference.) because there are two sub-matches when defining a regular expression.) It then assigns the value of the array key to date to 1478309879000, and then completes. Continue to match to id=2; Execute function (a,b,c), where a is the value of Id=2,b, the value of Id,c is 2, and the value of the array's key is the ID of 2. */ returnParames;//returns the array. } varparames = Parse_url (URL);//call function, incoming URL varDate = parames[' Date '];//gets the value of date varDates = DATE.SUBSTR (0, 10)//intercept the Required string //Convert date format functionGetlocaltime (NS) {return NewDate (parseint (NS) *). toLocaleString (). Replace (/:\d{1,2}$/, "); } alert (Getlocaltime (dates)); </script>
JS get URL Address parameter