Tuesday, March 27, 2012

Javascript code to get Query string value in sharepoint

var paramID=GetValue('ID');



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

No comments:

Post a Comment