Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 14 of 14
  1. #1
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Versus using the alert

    Is there another command I could use other than.....

    alert("Thank You for your information.");

    ....something that doesn't sound the same as the error message?
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    18,017
    Thanks
    203
    Thanked 2,538 Times in 2,516 Posts
    If the message is to appear after the user has completed and submitted a form then you can redirect to a "thank you" page,
    or you could make a pop-up window with a suitable message.

    An example:-

    <SCRIPT type="text/javascript">
    <!--
    function makemessage(page) {
    OpenWin = this.open page, "CtrlWindow","top=80, left=100,width=250,height=100, toolbar=no,menubar=no, location=no,scrollbars=no,resizable=yes");
    }

    function closepop(){
    if (OpenWin != null) OpenWin.close();
    }

    window.onunload=closepop;

    // -->
    </SCRIPT>



    Then

    onclick="makemessage('TheMessageFile.html'); return false"

    onclick can be replaced by some other event handler of course, such as onsubmit.

    and TheMessageFile.html contains whatever message you want to display.
    Last edited by Philip M; 01-11-2004 at 08:15 AM.

  • #3
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply Phillip.

    I tinkered with the code a bit.

    I was looking for a way to have a message come up that did not require a separate html file. That's why I was looking into alert.

    Currently, I do have a redirect to a thank you page.
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #4
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I put this code in:

    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);

    }

    It is called from inside of another function.

    What do I need to do to automatically close the pop-up window after a set period of time. Is there an statement that is put in the 'features' argument?
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #5
    New Coder
    Join Date
    Dec 2003
    Location
    Soraga, Trentino, Italy
    Posts
    13
    Thanks
    0
    Thanked 0 Times in 0 Posts
    try something like this...

    <script>
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    win=window.open(theURL,winName,features);
    window.setTimeout('win.close()',5000)
    }
    </Script>



    the popup should close after 5 sec

  • #6
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Dennis.

    Think I found my answer here as posted in reply by jujuraf.

    function DoSomething()
    {
    var outW = window.open("", "newwin", "top=250, left=250, height=150, width=300");
    outW.document.write("<HTML>")
    outW.document.write("<TITLE>Confirmation</TITLE>");
    outW.document.write("<font color=#0000CC>");
    outW.document.write("<div align=center><strong>Thank You");
    outW.document.write("<P>Your Information has been received.</P></strong>");
    outW.document.write("<div align=center>");
    outW.document.write("<input type=button name=button value=OK>");
    outW.document.write("</div>");
    outW.document.write("</HTML>");
    outW= window.setTimeout(outW.close(), 2000);
    }

    Windows closes, but right away and then I get 'Error on Page'.

    Last edited by jwindon; 01-11-2004 at 08:53 PM.
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #7
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Try removing:
    outW= window.setTimeout(outW.close(), 2000);

    And replace with:
    onblur=self.close()
    and add a body tag to your popup.
    outW.document.write("<body onload=self.focus()");


    If your redirect to the thank you page is called at the same time this popuup is called. The popup will close when the thank you page recieves focus

    ....Willy

  • #8
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If I put it like that.......the page that creates the pop-up closes.

    The DoSomething function is called before the submit function executes and sends to a rediret location.

    I'm attempting to have a pop up (created with this 'write' method) that says basically..thank you....and then closes after a few seconds. The user should be left staring at the redirect location.

    function DoSomething()
    {
    var outW = window.open("", "newwin", "top=250, left=250, height=150, width=300");
    outW.document.write("<HTML>")
    outW.document.write("<TITLE>Confirmation</TITLE>");
    outW.document.write("<body onload=self.focus()");
    outW.document.write("<font color=#0000CC>");
    outW.document.write("<div align=center><strong>Thank You");
    outW.document.write("<P>Your Information has been received.</P></strong></div></font>");
    outW.document.write("</HTML>");
    onBlur=self.close();
    }
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #9
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The DoSomething function is called before the submit function executes and sends to a rediret location.
    Why would you have your "Your Information has been recieved" popup fire before the form is even submitted?

    It should be: Submit --> popup --> location.replace="redirectLoction.html"

    BTW: Don't you need to close your body tag?
    outW.document.write("<body onload=self.focus()");

  • #10
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Willy:

    Well you caught me on the submit after the pop up. I fixed that. Had already found my syntax typo on the body tag. Still, after searching the forums and internet all afternoon, I'm at a loss as to how to close my pop up (which is not an html file that would be on the server as you see by the write method). So I've elected to give it up and let the user close that pop up themselves. I got close a couple times, but each time, it closed the page the DoSomething was called from versus the page the DoSomething function creates.

    This is where I left it.

    function DoSomething()
    {
    var outW = window.open("", "newwin", "top=250, left=250, height=150, width=300");

    outW.document.write("<HTML>")
    outW.document.write("<TITLE>Success</TITLE>");
    outW.document.write("<body>");
    outW.document.write("<font color=#0000CC>");
    outW.document.write("<div align=center><strong>Thank You");
    outW.document.write("<P>Your information has been received.</P></strong></div></font>");
    outW.document.write("</body></HTML>");
    //window.setTimeout('self.close()',7000);
    }


    called from:

    function validation(){
    if(.........
    }
    else {
    document.REG.submit();
    DoSomething();
    return true;
    }
    }
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #11
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If you use the onblur="self.close()" in the popup and set focus to your redirect page when it loads, the popup will lose focus and close itself when the focus shifts.

    But, you should also provide a close button on the popup anyway.

  • #12
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks Willy.

    I'm burned up with this for now. I have another collection to do right after this one...so maybe I can get it straight for that one. I tried your code, but I'm obviously doing something very wrong. I've attached the full page if you are interested in showing me the correction. If not; thanks for the guidance and I'll try again on the next project.

    Attached Files Attached Files
    -- Always thankful for kind and patient teachers willing to help a beginner.

  • #13
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I downloaded the file and will take a look at it later when I feel better. I have a migraine right now which is killing me.

    .....Willy

  • #14
    New Coder
    Join Date
    Jan 2004
    Location
    Kentucky
    Posts
    38
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sorry to hear that Willy

    Hope you feel better.

    (I do....with this much done)

    On to the next collection
    -- Always thankful for kind and patient teachers willing to help a beginner.


  •  

    Posting Permissions

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