2008/10/28

javascript: 以javascript取得query string (Netlobo.com | Get URL Parameters Using Javascript)

http://www.netlobo.com/url_query_string_javascript.html


function gup( name )
{
name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regexS = "[\\?&]"+name+"=([^&#]*)";
var regex = new RegExp( regexS );
var results = regex.exec( window.location.href );
if( results == null )
return "";
else
return results[1];
}

var myid= gup("id");

沒有留言:

T-SQL 語法風格