SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Hybrid View

  1. #1
    ********* Addict WP1's Avatar
    Join Date
    Aug 2000
    Location
    New York , USA
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello,

    I originally posted this at the Perl Category. But I think I should have posted it here. I think I will get more responses. I am requesting the other thread be closed. I apologize for any problem this may have caused.

    I am trying to get a pop up window of a chat "login" window to close spontaneously after the chat window comes up. Please go to the following page and click the "CHAT" link in the lower left column to see what I am referring to.
    IRONSTONE Example 1

    If I do not make the "login" panel a pop up window and place it into a page instead, the login panel goes back to the previous page I was on and the Chat window pops up.
    IRONSTONE Example 2

    What code could I place into the pop up "login" window in Example 1 above to get it to close after the chat window opens???

    The code is within the perl code for the Chat Script. I have placed the code at
    http://www.ironstone.f2s.com/bluechat.txt (I placed "txt" as the extension so the text would be visible. The extension is actually "cgi"

    I think it is the Java Script parts in the Configuration area and HTML as well as the Submit (Input Tag) Part of the code which need to be changed. I do not know how to do it.

    JavaScript in the Configuration part of "bluechat.cgi (bluechat.txt)
    Code:
    $additional = '<p><strong><I><a href="javascript:history.back();">Go Back</a></strong></I></p>';
    Java Script in the HTML Part
    Code:
    <!--
    function LogIn(){
    var MyWindow;
    var MyUrl;
    if (!document.forms[0].cname.value) {alert('You need to enter a name to use'); return;}
    MyUrl = 'bluechat.cgi' + '?cname=' + escape(document.forms[0].cname.value);
    MyWindow = window.open(MyUrl, "BlueChat", "STATUS=NO,TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,COPYHISTORY=NO,MENU=NO,RESISABLE=NO,SCROLLBARS=NO,TOP=50,LEFT=20,WIDTH=600,HEIGHT=500");
    window.history.back();
    }
    // --></script>
    Input Tag Part
    Code:
    <input type="button" value="Login" onclick="javascript:LogIn();">
    Entire Page Script
    Code:
    <html>
    <head>
    <title>IRONSTONE Chat</title>
    <script language="JavaScript"><!--
    function LogIn(){
    var MyWindow;
    var MyUrl;
    if (!document.forms[0].cname.value) {alert('You need to enter a name to use'); return;}
    MyUrl = 'bluechat.cgi' + '?cname=' + escape(document.forms[0].cname.value);
    MyWindow = window.open(MyUrl, "BlueChat", "STATUS=NO,TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,COPYHISTORY=NO,MENU=NO,RESISABLE=NO,SCROLLBARS=NO,TOP=50,LEFT=20,WIDTH=600,HEIGHT=500");
    window.history.back();
    }
    // --></script>
    </head>
    <body bgcolor="" text="#F1EAD3" link="#FFCC00" vlink="#E6C45E" alink="#FFD66B" "background="stone_txt_bg_300x200.jpg"">
    <TABLE WIDTH="450" CELLPADDING="5" CELLSPACING="0" BORDER="0" BGCOLOR="#A37951">
    <TR>
    <TD>
    <p align="center"><font color="#F1EAD3"><strong><big><big>Welcome to IRONSTONE Chat</big></big></strong></font></p>
    <p>RULES<br>1. No Chat with Foul Language and/or Sexual Content allowed in any Channel.<br>2. No Flaming allowed in any Channel.<br><br>CHAT ROOMS<br>&nbsp;&nbsp;&nbsp;&nbsp;Child Support<br>&nbsp;&nbsp;&nbsp;&nbsp;Spousal Support<br>&nbsp;&nbsp;&nbsp;&nbsp;Divorce<br>&nbsp;&nbsp;&nbsp;&nbsp;Separation<br>&nbsp;&nbsp;&nbsp;&nbsp;Single Parents<br>&nbsp;&nbsp;&nbsp;&nbsp;Pro Se<br>&nbsp;&nbsp;&nbsp;&nbsp;Anything Chat<br></p>
    <form onsubmit="javascript:{return false;}">
      <div align="center"><center><p><b>Enter a name to use while chatting</b><br>
      <input type="text" name="cname" size="20"><br>
      <input type="button" value="Login" onclick="javascript:LogIn();"></p>
      </center></div>
    </form>
    </td>
    <td bgcolor="#F1EAD3">
    <p align="center"><strong><font size="2" color="#A37951">Color Codes<br> Allowed in name:</font><br>
    <strong><font color="#0000A8">`1</font> <font color="#007000">`2</font> <font
    color="#008080">`3</font> <font color="#A80000">`4</font> <font color="#A800A8">`5</font> <font
    color="#A85400">`6</font> <font color="#808080">`7</font> <font color="#505050">`8</font> <font
    color="#5454FC">`9</font> <font color="#00B000">`0</font> <font color="#00A0A0">`!</font> <font
    color="#FC5454">`@</font> <font color="#FC54FC">`#</font> <font color="#AAAA00">`$</font> <font
    color="#000000">`%</font></strong><br>
    
    <font size="2" color="#A37951">Use and type <font size="4" color="#A37951">`</font> mark in top left button on keyboard.<br>
    <I>Example:</I><br> `1James = <font color="#0000A8">James</font></strong></p></font>
    </td>
    
    <td align="center">
    <p><b><p><strong><I><a href="javascript:history.back();">Go Back</a></strong></I></p>Please continue to surf  &nbsp;&nbsp; IRONSTONE while chatting.<br><strong><a href="/disclaimer.html"><font color="#FF9900">Disclaimer</font></a></strong></b></p>
    <p><em><small>Version 2.3</small></em></p>
    </TD>
    </TR>
    </TABLE>
    </body>
    </html>
    Any and all input and help appreciated.

    WP
    Webbing Along!!!

  2. #2
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you sure did make alot of effort to get your query clear.
    however, i understand what you're saying...or is it?

    you are trying to close a window when you submit?
    have you tried the:

    onclick command?

    onclick="window.close();" ?

    or...
    assign the login window a name.
    then when teh chat window loads, use the onload command to close that window.



    *if i didn't get yuou right, kindly explain to me the process you want the respective iwndows to open and close. form what i see, its based upon javascript =)*
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein

  3. #3
    SitePoint Wizard creole's Avatar
    Join Date
    Oct 2000
    Location
    Nashvegas Baby!
    Posts
    7,845
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Lyon's got the right idea...either close the "login" window when you click the submit form, OR
    close the login window when the chat page loads.

    <input type="button" value="Login" onclick="javascript:LogIn();"> (by the way, you have a space in java script, it should be javascript (all one word))


    yep...this works...
    <input type="button" value="Login" onclick="javascript:LogIn(); self.close()">
    Adobe Certified Coldfusion MX 7 Developer
    Adobe Certified Advanced Coldfusion MX Developer
    My Blog (new) | My Family | My Freelance | My Recipes

  4. #4
    ********* Addict WP1's Avatar
    Join Date
    Aug 2000
    Location
    New York , USA
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi lynlimz and creole,

    Thank you for responding,

    When I tried,
    <input type="button" value="Login" onclick="java script:LogIn(); self.close()">
    The "Login" Window remained and the "Chat" window did not come up.

    When I tried,
    <input type="button" value="Login" onclick="java script:LogIn(); window.close();">
    The "Login" Window remained although the "Chat" window did come up.

    In the code below. Is there a way to add either "function self.close()" or "function window.close()" in addition to the "function LogIn()" which is already there.

    Code:
    <script language="JavaScript"><!--
    function LogIn(){
    var MyWindow;
    var MyUrl;
    if (!document.forms[0].cname.value) {alert('You need to enter a name to use'); return;}
    MyUrl = 'bluechat.cgi' + '?cname=' + escape(document.forms[0].cname.value);
    MyWindow = window.open(MyUrl, "BlueChat", "STATUS=NO,TOOLBAR=NO,LOCATION=NO,DIRECTORIES=NO,COPYHISTORY=NO,MENU=NO,RESISABLE=NO,SCROLLBARS=NO,TOP=50,LEFT=20,WIDTH=600,HEIGHT=500");
    window.history.back();
    }
    // --></script>
    Maybe the script would close the "Login" Window if one of the two functions you both suggested was added to the above script somewhere as well as to the submit <INPUT> tag.

    I donno just asking.

    I'm embarrassed to show my lack of JavaScript (one word not two ). Although I have a limited to none knowledge of perl and php I understand the concepts better than JavaScript. I have to really buckle down and learn it from A to Z at some point.

    Thanks again for all your help.

    WP
    Webbing Along!!!

  5. #5
    ********* Addict WP1's Avatar
    Join Date
    Aug 2000
    Location
    New York , USA
    Posts
    407
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    lynlimz and creole!!!

    I GOT IT!! I GOT IT!! I GOT IT!!!!!

    In my travels regarding this script, I was told by someone who did not have time to explain to do the following.

    Look in the bluechat.cgi (bluechat.txt, which I had posted online) and find this statement which is inside the logIn function:
    window.history.back();

    and replace it with this:
    setTimeout('parent.window.close();',2000);

    The "Login" window now closes when the "Chat" Window opens,
    http://www.ironstone.f2s.com/final.shtml

    You folks probably understand the reason for doing this.

    I really gotta learn me some JavaScript.

    Appreciate you both taking the time to help me.

    WP
    Webbing Along!!!

  6. #6
    The Hiding One lynlimz's Avatar
    Join Date
    Jul 2000
    Location
    Singapore
    Posts
    2,103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    COOOL@@@!!! lol
    *grin* svaes me the toruble of looking at your chunk of code..lol

    timeout..ahhaz..
    icici..

    though if it loads slower..it won't coinciden.....but its good =)
    coingrats!
    "Imagination is more important than knowledge. Knowledge is limited. Imagination encircles the world."
    -- Albert Einstein


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
  •