Yahoo Answers is shutting down on May 4th, 2021 (Eastern Time) and beginning April 20th, 2021 (Eastern Time) the Yahoo Answers website will be in read-only mode. There will be no changes to other Yahoo properties or services, or your Yahoo account. You can find more information about the Yahoo Answers shutdown and how to download your data on this help page.

Passing Variables Inside window.open for JavaScript?

Here is the code I currently have :) Most of which works great..

<script type="text/javascript">

var mySideRes = screen.width*.2

function WindowOpen(url)

{

window.open(url, "sideBar", "width='mySideRes', height=200, resizable=yes, scrollbars=no, status=no");

}

</script>

...

Checking this <a href="#" onClick="WindowOpen('sidebar.php');">

Sidebar</a>

So as you see, it will open up a window however the variable for 20% of the current browser width will not pass through it keeps opening up in 100%, I also will try to make a variable for 100% of the current height and try to pass that through if i can get this working

Thanks! Shawn

Update:

Jeremy my man! You are awesome, I cant believe i forgot something that simple! :)

A++!

Update 2:

Jeremy my man! You are awesome, I cant believe i forgot something that simple! :)

A++!

2 Answers

Relevance
  • 1 decade ago
    Favorite Answer

    Try this:

    window.open(url, "sideBar", "width=" + mySideRes + ", height=200, resizable=yes, scrollbars=no, status=no");

  • raap
    Lv 4
    4 years ago

    you're calling alert_math1() with 2 parameters: javascript:alert_math1(x,y) yet those parameters are on no account exceeded into alert_math(): alert("the form is " + alert_math(z)); in case you regulate the z parameter to x, y interior the line above i think of of you will come across your code executes as expected (0:

Still have questions? Get your answers by asking now.