SitePoint Sponsor

User Tag List

Results 1 to 12 of 12
  1. #1
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Pop up and disappear

    I'm sure it can be done, but I am having a couple of difficulties with pop-ups using javascript.

    Most simply, can I use just one script for mutliple links, ie:

    function open_cover(url) {
    cover = window.open(url, "cover","toolbar=0,title=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=400,height=616,position: left=100px; top=60px");
    }

    for several different covers? Or do I have to have a different funtion for each individual one?

    Also, can I use a script to open a pop-up for a short time and then automatically close it again?
    DW_WebDesign

  2. #2
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes you can use that function for all your pop-ups,
    provided they all fit into the same size.

    You can close it after a timeout too - you just have to assign the result to a variable, and then close it when you're ready.


    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  3. #3
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks. Yes, I want all the pop-ups to open at the same size, that was the general idea.
    Excuse my naivety about the timeout though, how do I go about assigning the reult to a variable? It doesn't need to be at a specific time, just after a time has elapsed will do, like in java. It is the assigning etc that I'm not sure on.
    DW_WebDesign

  4. #4
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    var nWin=window.open(bla...


    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  5. #5
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Sorry, I don't quite follow. Does the rest of the script go in the brackets (bla...), and is nWin or n substituted with a time? Also, is the time specified in ms/s/other?

    David
    DW_WebDesign

  6. #6
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    oh b**ger!
    I just scrolled up to see you were assigning the function result to a variable anyway (cover).

    in THAT case - setTimeout('cover.close()', 2000);

    where the number is in ms.

    Flawless
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  7. #7
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK, thanks. I hadn't realised (admittedly I only adapted the script, didnīt originally write it).

    That's very helpful. Cheers!

    David
    DW_WebDesign

  8. #8
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DW_WebDesign

  9. #9
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    BTW, So far only THE INTERNATIONAL ZOO YEARBOOK. III
    and THE MAMMALS
    DW_WebDesign

  10. #10
    Perl/Mason Guru Flawless_koder's Avatar
    Join Date
    Feb 2002
    Location
    Gatwick, UK
    Posts
    1,206
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    huh?!
    ---=| If you're going to buy a pet - get a Shetland Giraffe |=---

  11. #11
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It is a bibliography with thumbnails of the covers, Iīm just re-wroking it, but so far have added "View cover image" links seperately as the thumbnails still link to the purchasing site. So the "View cover image" link for those 2 books uses the pop-up script with the timeout.
    DW_WebDesign

  12. #12
    SitePoint Member
    Join Date
    May 2002
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That should of course say "re-working", I just canīt type!
    DW_WebDesign


Bookmarks

Posting Permissions

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