36 users online (2 members and 34 guests)  


  Results 1 to 6 of 6

Related

  1. Replies: 1
  2. Replies: 0
  3. Multiple Popup windows    Forum: Javascript Forum
    Replies: 1
  4. Loading a window with partic. size    Forum: Javascript Forum
    Replies: 2
  5. Replies: 5
  1. #1
    Piano's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    7

    multiple files loading to one pop window; closing pop-up windows

    I have two questions about pop up windows, and they're both really elementary. I looked around, but couldn't find specifically what I was looking for. I'm sorry if this is repetetive.

    1. One page of my website is a list of links, all of which lead to other pages in my site with different types of information. These links open in pop-up windows. What I want is, when the user clicks a new link, the new page should load in the same pop-up window that the last link loaded in, replacing it (so that a user doesn't end up with sixteen browser windows open if they forget to close the windows).

    And,

    2. I want to include a "close window" link on all of the pop-up windows, that if they click on it the window closes, so all that's there is the original "Links" page again.

    I know it's possible to do these things, but when I was looking for instruction I either found incredibly elementary html tutorials ("this is how you make italics"), or code far too advanced for me. Thanks for any help. : )

    Jen

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: multiple files loading to one pop window; closing pop-up windows

    Hiya, welcome to the forums.

    Are you opening your pages with target="_blank"? If so, change the target to something like target="_piano" for all of them. They will then always open in the same window.

    To make them closeable, try

    Code:
    <input type="button" onclick="self.close();" value="close window">
    or

    Code:
    <a href="javascript:void(0);" onclick="self.close();">close window</a>
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  3. #3
    Piano's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    7

    Re: multiple files loading to one pop window; closing pop-up windows

    Naming the target worked for me when I just wanted them to pop up in a new window, but these are javascript pop-ups (I want the windows to be a certain size, because of the image I'm using for a background). When I name the window they'll pop to, the sizing gets skewed, and the content doesn't display.

    But the second coding to make them closeable worked. Thank you!

  4. #4
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: multiple files loading to one pop window; closing pop-up windows

    No worries.

    Showw me your popup function and we can fix that too.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?

  5. #5
    Piano's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2005
    Posts
    7

    Re: multiple files loading to one pop window; closing pop-up windows

    Thank you! I've been able to create some complicated sites, but it's really all through reference tutorials. I usually don't know what I'm doing well enough to fix mistakes. This is the part in the head:

    <script language="javascript">

    function popup(URL)
    {
    day = new Date();
    id = day.getTime();
    eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=no,scrollbars=no,location=0,statusbar=no,menubar=no,resizable=no,width=433,height=485,left=295.5, top=121.5');");
    }

    </script>

    And this is the part in the body

    1.</b> <a href="javascriptopup('adamson/obituary.html')">take a wild guess</a>

    I tried specifying a target (so it was <a href="javascriptopup('adamson/obituary.html')" target="_oops">take a wild guess</a> ) but it didn't work.

    Thanks for your help. ^_^

  6. #6
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662

    Re: multiple files loading to one pop window; closing pop-up windows

    Ahha

    Change

    Code:
    id = day.getTime();
    to

    Code:
    id = 'badger';
    And they should all use the same popup.
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread