window.open

R

roN

Hi,

Why isn't following not working,
well, it opens a windows but not with the size, passed to the function in
variable w & h. Thank you

function open_window(URL,title,w,h)
{ window.open(URL,title,"width=w,height=h,left=100,top=200,menubar=no,resizeable=no,scrollbars=no,status=no,toolbar=no");
}

i call it like:
onclick="open_window('admin.php','Admin',100,100)"

but it's not working as expected, why not? The size is not correct :(
Thanks for hints!
 
W

web.dev

roN said:
Hi,

Why isn't following not working,
well, it opens a windows but not with the size, passed to the function in
variable w & h. Thank you

function open_window(URL,title,w,h)
{ window.open(URL,title,"width=w,height=h,left=100,top=200,menubar=no,resizeable=no,scrollbars=no,status=no,toolbar=no");
}

That is because you have not separated your variables from the string.

window.open(URL, title, "width=" + w + ",height=" + h + ",left=100,
....etc...";
 
R

roN

web.dev said:
That is because you have not separated your variables from the string.

window.open(URL, title, "width=" + w + ",height=" + h + ",left=100,
...etc...";

yup, that's it. thank you!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top