SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Popup alert that moves user to page depending on action

    Hey,

    I need to create an alert box that tells the user they have a new private message, if they click ok they are taken to there inbox, if they click cancel the message just goes away, something like what was used at Sitepoint forums (I don't think it is used a anymore)

    Thanks
    Garlic bread, I've tasted it, it's the future

  2. #2
    SitePoint Addict
    Join Date
    May 2000
    Posts
    313
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could try confirm like this:
    if(confirm("You have a new message"))
    {location.href="message.html"}

    If they click ok then it redirects them, if they click cancel nothing happens.

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Smarky
    Hey,

    I need to create an alert box that tells the user they have a new private message, if they click ok they are taken to there inbox, if they click cancel the message just goes away, something like what was used at Sitepoint forums (I don't think it is used a anymore)

    Thanks
    Do you mean something like this?

    Code:
      var new_message = true;
      var inbox_url   = 'inbox.php';
      if (new_message && confirm("You have a new message in your inbox, would you like to goto your inbox."))
      {
    	window.location.href = inbox_url;
      }

  4. #4
    BoOm-Rocka! Smarky's Avatar
    Join Date
    Jun 2000
    Location
    England
    Posts
    1,319
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Andrew-J2000
    Do you mean something like this?

    Code:
    var new_message = true;
    var inbox_url = 'inbox.php';
    if (new_message && confirm("You have a new message in your inbox, would you like to goto your inbox." ))
    {
    	window.location.href = inbox_url;
    }

    yes thanks to the two of you, I got it implemented in my code now

    Sorry I know it is a simple question for you guys but i don't do Javascript
    Garlic bread, I've tasted it, it's the future


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
  •