Try like this as well
covertPostSub("/xyz/test.jsp","?param1=param1¶m2=param2","_self","true");
covertPostSub("/xyz/test.jsp","?param1=param1¶m2=param2","_blank","true");
var convPop = null;
function covertPostSub(action,paramsTosend,targetIframe,isWindow){
var Popup = null;
var form = document.createElement("form");
form.setAttribute("method", "POST");
form.setAttribute("id","TheForm");
form.setAttribute("action", action);
form.setAttribute("target", targetIframe);
var params = paramsTosend;
params = params.substring(1, params.length);
params = params.split("&");
for(var key=0; key<params.length; key++) {
var sa = params[key];
sa = sa.split("=");
var xs = (sa[1]);
if(params.hasOwnProperty(key)) {
var hiddenField = document.createElement("input");
hiddenField.setAttribute("type", "hidden");
hiddenField.setAttribute("name", sa[0]);
hiddenField.setAttribute("value",xs);
form.appendChild(hiddenField);
}
}
document.body.appendChild(form);
form.style.display = "none";
if(isWindow){
window.open('', "formpopup","width=900,height=590,toolbar=no,scrollbars=yes,resizable=no,location=0,directories=0,status=1,menubar=0,left=60,top=60");
form.target = 'formpopup';
form.submit();
}else{
form.submit();
}
}