Grabbing query string values is easy in SharePoint with some javascript...
var xid = GetUrlKeyValue("ItemId", false, location.href);
But what if ItemId didn't exist in certain instances, how can you code in some logic to first determine the query string item exists, and branch accordingly? I've tried a few approaches, but not having any luck.
if ((typeof xid!== "undefined") && (xid!== null)) {
alert(xid);
} else {
alert("undefined");}
and
if (typeof xid === "undefined") {
alert("undefined");
} else {
alert("defined");}
Am I on the right track here?