Thursday, 22 May 2008

function MakeSafeForURL js

function MakeSafeForURL(strText) {
//eg given it's great+,
// returns it%20 great%2B
//return encodeURIComponent(strText);

strText = strText.replace(/'/g, "");
strText = strText.replace(/"/g, "");
strText = strText.replace(/\+/g, "");
strText = strText.replace(/&/g, "");
strText = strText.replace(/%/g, "");

return strText
}

No comments: