Thursday, November 20, 2008

Friday, November 14, 2008

JavaScript: Get URL Parameters

var _GET={};
for(var m, v=location.href.split(/[?&]/), k=v.length-1;k>0;k--)
_GET[(m=v[k].split(/[=#]/))[0].toLowerCase()] = m.length>1?decodeURI(m[1]):"";

example:

mypage.aspx?MyParameter=2

var param=_GET.myparameter; (always use lowercase)

Tuesday, November 11, 2008

focus field javascript

<script language="javascript" type="text/javascript">
_spBodyOnLoadFunctionNames.push("addAttributes");

function addAttributes() {
var control = document.getElementsByName("WPQ2accountsSearch");

if(control.length > 0)
{
control.item(0).focus();
}
}
</script>