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 3 of 3

Thread: alerts!!!

  1. #1
    Regular Coder
    Join Date
    Sep 2002
    Location
    Nottingham, UK
    Posts
    110
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alerts!!!

    Hi ALL!!!

    Does anyone know how to close / redirect a user to another page from an alert. I want to be able to click on ok and then go to another page.

    Any ideas?
    Thanx
    Sarah
    You are not a human being having a spiritual experience, your a spiritual
    being having a human experience.

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Posts
    3,467
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can do that with a confirm

    if ( confirm( "Whatever message here" ) ) top.location.href = 'somepage.htm';
    My Site | fValidate | My Brainbench | MSDN | Gecko | xBrowser DOM | PHP | Ars | PVP
    “Minds are like parachutes. They don't work unless they are open”
    “Maturity is simply knowing when to not be immature”

  • #3
    Regular Coder
    Join Date
    Sep 2002
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts
    easy!
    alert answer..

    would you like to be displayed with an option of yes and no in an alert?
    use:

    <script>
    function asktogo(web,txt)
    {
    askme=confirm(txt)
    if(askme==true)
    window.location.replace(web)
    else
    return false
    }
    </script>

    then when you want the option to come up as a link, put this in your html document(where you want to link to be):
    <a href="javascript:asktogo('*','***');">**</a>

    *** This is where you put the question text, before your visitor is taken to there specified destination.
    ** Of course put the title for the link :D
    * Put the website address here so your want your visitors to be asked first before being taken there.

    Not all of this might be this right, i might have to edit it a few times. lol.
    NOTICE: FOR SOME REASON WHENEVER I TYPE IN JAVASCRIPT OR SOMTIMES, IT COMES OUT AS java script please do not make your scripts go wrong from this, always change it with no space in the middle :D
    Last edited by vkidv; 01-14-2003 at 05:08 PM.
    Regards
    VKiDV


  •  

    Posting Permissions

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