tags:

views:

34

answers:

3

Hi!

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)">
+5  A: 
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:

Ricket
+2  A: 
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

sushil bharwani
A: 

Also, body onload="javascript: poponload(200, 500,yes)" is one javascript: too many.

Humberto