Forum Moderators: open

Message Too Old, No Replies

MM_openBrWindow parameters...

(problem with the size of the window)

         

windranger

3:10 pm on Sep 20, 2004 (gmt 0)

10+ Year Member



Hi there,

I just want to make a pop-up window, with the size of the screen and width 35% of the screen.
So I'm using this code:

<script language="JavaScript">
<! - -
function MM_openBrWindow(theURL,winName,features) { //v2.0
wd = (screen.width)*0.35;
ht = screen.height;
}
//-->
</script>

..
..
.. (html stuff)
..
..
..

<a href="javascript:;" onfocus='this.blur()'>
<img src="../abc.jpg" onClick="MM_openBrWindow('../images/hotspot.jpg','SomeName,'height='+ht+',width='+wd+',')"></a>

If the width and height are clearly specified in pixels, the code works fine, but this one doesn't.
I don't want to use a fixed size for the window, so if anybody has an idea about what's wrong with this code, please advise.

Thanks.

Bernard Marx

8:15 am on Sep 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



<script language="JavaScript"> 
<! - -
function posPop(url,name)
{
var w=screen.width,h=screen.height;
open(url,name,"width="+w+",height="+h);
}
//-->
</script>

....
<!-- dest src in href allows access to JS-disabled -->
<a href="../images/hotspot.jpg" onclick="posPop('../images/hotspot.jpg','SomeName'); return false;"
onfocus="this.blur()">
<img src="../abc.jpg"></a>

If you are going to fiddle with Dreamweaver code, it may help to take a Javascript tutorial or two first :)