Web Analytics Made Easy -
StatCounter Simple Question?? - CodingForum


No announcement yet.

Simple Question??

  • Filter
  • Time
  • Show
Clear All
new posts

  • Simple Question??


    what i want to know is how i can add a target window name to a close window link,

    target window would be "POPUP"
    <a href="javascript:window.close();">

    what i would to do is have the current popup window close,
    while opening the new one..

    something like this, though i'm sure this isn't right:

    <a href="images/<? echo $sub_value['PicName'] ?>" target="POPUP" title="pic" onMouseOver="(window.status='Click on the picture to view the full image.'); return true" onclick="window.close(target='POPUP');popImg(this.href); return false;">

    can this be done? and if so could some one please show me the currect way to do this?

    thanks in advance for your time!

  • #2
    It can be done if you have a reference to the window you want to close. window.open() returns a reference to the window it just opened. window.opener is a reference to the window (if any) that created the current window.

    I seem to remember being able to access arbitrary windows based on the name but it could be that it was frames in a frameset, not independent windows.


    • #3
      hmm, ok.
      well if anyone has any ideas how i can do this, that would be great, i know it's a small thing, but it would make my script much better.

      I'm new to javascripting, but any examples would be great!

      thanks again for all your time & help!


      • #4
        You didn't show how the popImg() function looks like so I'm guessing on why you want to close the popup. I think you don't need to close the window as you can resize the window to the image's size even if the window is already open. Check this, it may give you an idea.
        vBulletin Mods That Rock!