• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 279
  • Last Modified:

how to set size of new window

I am in the process of totally redesigning the website using CSS table-less design. The original site was based on 3 templates and an end-user uses Contribute to update bits and pieces.

So my new template needs a link to an "email a friend" page which ideally would be a small pop-up window which would also have a close button. The only info I can find to do this uses a javascript function which seems to need to know the name of the page I'm linking FROM.

I'm using DW MX. Is there a way to do this?
0
JillC
Asked:
JillC
  • 3
1 Solution
 
dorbraxtonCommented:
Put this client-side code in at the top of the page:  be sure to change the width and height

<script language=javascript>
function OpenMyWindow() {
this.open('MySendMail.htm', 'CtrlWindow', 'toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, width=150, height=150');
}
</script>

then on the link or button:

<input type=image alt=Exit src='images/SendMail.gif' onClick="OpenMyWindow();return false;" id=image1 name=image1>
0
 
dorbraxtonCommented:
The important bit on the link is:

onClick="OpenMyWindow();return false;"

you can use any tag that supports onClick.
0
 
dorbraxtonCommented:
Here is a working sample:

<%@LANGUAGE="JAVASCRIPT"%>
<html>
<script language=javascript>
function OpenMyWindow() {
this.open('MyPage.htm', 'CtrlWindow', 'toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, width=150, height=150');
}
</script>
<head>
<title>Untitled Document</title>
</head>

<body>
Your other page elements here.

<input type=image alt=Exit src='images/MyPic.gif' onClick="OpenMyWindow();return false;" id=image1 name=image1>

</body>
</html>
0
 
JillCAuthor Commented:
I discovered my own solution. I opened the Behaviours panel and selected Open Browser Window and then entered the parameters. However, the default for this was onMouseOver so it took me a while to find that it should have been onClick and once I'd fixed that it worked fine.

The scripted inserted into the head was
function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

The link -
<a href="#" onclick="MM_openBrWindow('../send/sendthis.html','sendthis','width=380,height=440')">Email
      A Friend</a>

For the Close button, I found this script:
<a href="javascript:void(0)" onClick="self.close()">Close window</a>

So, it works, it does what I want, even though it looks a bit different to your suggestion dorbraxton.

I will award you the points because you took the time to try to help me. But dorbraxton, this is the Dreamweaver forum - you should have given me the behaviours solution.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: MCSA MCSE Windows Server 2012

This course teaches how to install and configure Windows Server 2012 R2.  It is the first step on your path to becoming a Microsoft Certified Solutions Expert (MCSE).

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now