Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Jul 2009
    Posts
    26
    Member #
    19444
    Hi, I have a music site, and on one page surfers can click on song titles and it opens up a pop-up window containing the lyrics.

    When you click onto the main window again, the pop-up then relegates to underneath it, and if you click on the same link again, you get nothing - unless you closed the pop-up first.

    How can I modify my javascript so clicking on the pop-up link will bring an already open window to the front?

    Here is the popup code currently:

    Code:
    <a href="javascript:void(window.open('rpages/poar/dragofsloth.html','The Drag of Sloth','resizable=1,width=585,height=420,top=60,left=60'))">1. The Drag of Sloth</a>

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    You have to focus() the window. Try something like this (untested). Would be better to slap the code in a function and call taht from your link.

    <a href="javascript: var x = window.open('rpages/poar/dragofsloth.html','The Drag of Sloth','resizable=1,width=585,height=420,top=60,le ft=60'); x.focus();">1. The Drag of Sloth</a>

  4. #3
    Junior Member
    Join Date
    Jul 2009
    Posts
    26
    Member #
    19444
    It works! Thanks Smoseley, really appreciate it. So you're saying (I'm a j.script novice, excuse me) I should put the bulk of that code inside <script></script> tags in the head of the document?

    Someone on another forum gave me something like that, which applied itself to the specific div that the links appeared in, but I had to lose the individual code for each link, which meant losing the unique sizing attributes for each one - any idea how you'd get around that?

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    I was thinking something simpler, like:

    Code:
    <script type="text/javascript">
        function popWindow(url, title, width, height, top, left) {
            attrs = 'resizable=1,width=' + width + ',height=' + height + ',top=' + top + ',left=' + left;
            var x = window.open(url, title, attrs);
            x.focus();
        }
    </script>
    
    ... rest of your page ...
    
    <a href="javascript: popWindow('rpages/poar/dragofsloth.html', 'The Drag of Sloth', 585, 420, 60, 60);">1. The Drag of Sloth</a>

  6. #5
    Junior Member
    Join Date
    Feb 2010
    Location
    3 Locust Street, Suite A Assonet, MA 02702
    Posts
    6
    Member #
    21118
    I think you should try this

    var newwindow;
    function poptastic(url)
    {
    newwindow=window.open(url,'name','height=400,width =200');
    if (window.focus) {newwindow.focus()}
    }
    This will do rudimentary page to pop up off your main page on command from a link, you'll need the following JavaScript code and JavaScript link.

  7. #6
    Junior Member
    Join Date
    Jul 2009
    Posts
    26
    Member #
    19444
    That works like a charm, cheers smoseley, thanks too joomlads07


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Search tags for this page

after first click have link bring pop up window to front

,

bring popup to front

,

bring to front window open with javascript

Click on a term to search for related topics.
All times are GMT -6. The time now is 11:02 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com