how to set size of new window

Posted on 2005-04-15
Last Modified: 2010-04-25
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?
Question by:JillC
    LVL 2

    Accepted Solution

    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() {'MySendMail.htm', 'CtrlWindow', 'toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, width=150, height=150');

    then on the link or button:

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

    Expert Comment

    The important bit on the link is:

    onClick="OpenMyWindow();return false;"

    you can use any tag that supports onClick.
    LVL 2

    Expert Comment

    Here is a working sample:

    <script language=javascript>
    function OpenMyWindow() {'MyPage.htm', 'CtrlWindow', 'toolbar=no, menubar=no, location=no, scrollbars=no, resizable=no, width=150, height=150');
    <title>Untitled Document</title>

    Your other page elements here.

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


    Author Comment

    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,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.


    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Adobe Dreamweaver CS5 is a WYSIWYG web page editor that has advanced HTML, CSS, and Javascript rendering functionality and is probably the most well-known HTML editor available. Much of Dreamweaver's appeal centers around the Design View interfac…
    This article is very specific and is only intended to help if you are installing Dreamweaver 8 in a Windows 7 environment with Office 2007 installed.   I'm not sure why Microsoft tends to release OS' that should not be released but they do.  Windows…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now