Reputation: 13488
How do i go about passing the value of width ,height,resize received as parameter to window.open using javascript?
Thanks
Example
function poponload(mywidth,myheight,resizeVal)
{
testwindow = window.open ("http://www.yahoo.com", "mywindow","location=1,status=1,scrollbars=1,width=+mywidth+,height=myheight,resizeVal");
testwindow.moveTo(0,0);
}
<body onload="javascript: poponload(200, 500,yes)">
Upvotes: 0
Views: 477
Reputation: 7199
Also, body onload="javascript: poponload(200, 500,yes)"
is one javascript:
too many.
Upvotes: 0
Reputation: 30207
testwindow= window.open ("http://www.yahoo.com", "mywindow","location=1,status=1,scrollbars=1,width="+mywidth+",height="+myheight+",resizeVal");
use this see the string concatenation
Upvotes: 3
Reputation: 34085
function poponload(mywidth,myheight,resizeVal) {
testwindow= window.open("http://www.yahoo.com", "mywindow", "location=1,status=1,scrollbars=1,width="+mywidth+",height="+myheight+",resizable="+resizeVal);
testwindow.moveTo(0,0);
}
Also you should then pass in "1" or "0" for resizeVal, like so:
<body onload="poponload(200,500,1)">
Further reading:
Upvotes: 5