function getReqParam( 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]; } }i will explain the logic later on ;-) that reminds me, i also need to add a source code highlighter to my blog.. hang on until the long weekend, will get it done!!
September 15, 2009
javascript snippet for getting url parameters
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment