Skip navigation
KSerdakowski
Currently Being Moderated

Controlling behaviours in CS5 Dreamweaver

Feb 6, 2013 5:39 PM

Hello,

I have already asked the question about this issue several weeks ago and got some reply from Nancy O. I've tried my best to solve my problem , according to her advices but I've failed!

 

My problem is:

 

I need to open many new browser windows within my website and while developping it, few years ago, I used Dreamweaver CS5 behaviour: "Open Browser Window". Everything is working fine except one feature: Clicking link the new window opens but the original page (this containing clicked link) reloads which is bad for me. I need to keep the original page in the same position where  it was while link was clicked.

 

Nancy O. suggested to use JQuery FancyBox and I tried it, but my web site contain about 30 pages with many links to open new window in each and I cannot afford by now to rewrite my entire web site.

 

Please help mi to solve this issue!

 

Here is the URL of one o the pages of my website: http://www.szaser.com/Rod_Kozlakowskich.html

Do not be afraid it is in Polish!

 

Thanks to all in advance

 

Christophe Serdakowski

 
Replies
  • Currently Being Moderated
    Feb 7, 2013 7:49 AM   in reply to KSerdakowski

    I cannot afford by now to rewrite my entire web site.

    Well then you you can not solve it.

    That is the way "open new browser windw" behavior works

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 9:33 AM   in reply to KSerdakowski

    There is a way you can fix your issue, it will require hand coding.

     

    You can add a return false to your onclick events, like this...

     

    <a href="#" onclick="MM_openBrWindow('new-window.html','window-name','width=500,h eight=500'); return false;">Your  Link Here</a>

     

    That "should" keep the opener page from shifting back to the top when the window.open link is clicked..

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2013 10:10 AM   in reply to KSerdakowski

    Christofe your answer lies in JavaScript and in Dreamweaver's excellent replace function.

     

    Add the following code to the <head> area of all pages where you need to open something in a new window:

    <script type="text/javascript">

    function OpenNewWindow(bigurl, width, height)

    {

        var newWindow = window.open("", "pictureViewer",

            "location=no, directories=no, fullscreen=no, " +

            "menubar=no, status=no, toolbar=no, width=" +

            width + ", height=" + height + ", scrollbars=no");

        newWindow.document.writeln("<html>");

        newWindow.document.writeln("<body style='margin: 0 0 0 0;'>");

        newWindow.document.writeln("<a href='javascript:window.close();'>");

        newWindow.document.writeln("<img src='" + bigurl +

           "' alt='Click to close' id='bigImage'/>");

        newWindow.document.writeln("</a>");

        newWindow.document.writeln("</body></html>");

        newWindow.document.close();

    }

    </script>

    Now, anything you need to open in a new window, you can use the following JavaScript function:

    <a href="#" onclick="OpenNewWindow('images/bigpicture.jpg', 500, 500); return true;">

       <img src="images/smallpicture.jpg" alt="Click..."/>

    </a>

     

    You can format it for any size, I have it set for 500x500 pixels squre.

     

    You can also change the newWindow.document.writeln statements to include everything from text, headers, footers and so on.

     

    I would also mention that it's probably time for a redesign of your website anyway. Your drop-down menus cover other menus. And I would create a master page and make that a Dreamweaver Template, that way your "embiggerizor" JavaScript code can be put into all pages by default.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points