1. Tuyển Mod quản lý diễn đàn. Các thành viên xem chi tiết tại đây

How to detect if a window is open or closed?

Chủ đề trong 'Hỏi đáp Tin học' bởi thanhhai, 18/05/2001.

  1. 1 người đang xem box này (Thành viên: 0, Khách: 1)
  1. thanhhai

    thanhhai Thành viên quen thuộc

    Tham gia ngày:
    18/05/2001
    Bài viết:
    408
    Đã được thích:
    0
    Dear friends,

    I am building my personal web where there is a "Links" page. This page contains some
    hyperlinks, and I want when user clicks onto a link, say AAA, the respective
    website will be open in a separate window. When user click onto the link
    BBB, the BBB website will replace the AAA in the same subordinate window.

    My question is that how to detect if the subordinate window is open or not.
    If it is open, then the BBB link will use it to display the BBB website.
    Otherwise, we will (re)create the window and then display BBB website.

    Enclosed is the illustrative page. As you see, I have to open the
    subordinate window every time the main page is loaded, and if the
    subordinate window is accidentally closed by user and then he/she clicks
    onto another links, an error will occur.

    <HTML>
    <HEAD>
    <SCRIPT>
    <!--
    subWindow = window.open('','subWin')
    this.focus()

    function updateWindow(windowString) {
    if (subWindow.closed) {
    subWindow = window.open(windowString,'subWin')
    }
    else {
    subWindow.location.href = windowString
    }
    subWindow.focus()
    }
    -->
    </SCRIPT>
    </HEAD>

    <BODY>
    <P>
    <A HREF="javascript:updateWindow('http://12e.itgo.com')">Lop 12E</A>
    <A HREF="javascript:updateWindow('http://mutrap.4t.com')"><BR>Mutrap</A>
    <A HREF="javascript:updateWindow('http://unicode.itgo.com')"><BR>Unicode</A>
    </P>
    </BODY>
    </HTML>

    Thank you.

    Thanh Hai
    thanhhai@mot.gov.vn

    Thanh Hai
  2. Ngocanh

    Ngocanh Thành viên quen thuộc

    Tham gia ngày:
    20/04/2001
    Bài viết:
    114
    Đã được thích:
    0
    I think you are wrong code for your site
    Please see the "html tab list " in my site
    HTML TAG
    http://anhhn.8k.com

Chia sẻ trang này