Alert Box

This is a discussion on "Alert Box" within the JavaScript Forum section. This forum, and the thread "Alert Box are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Mar 25th, 2008, 22:55
Reputable Member
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Alert Box

Ok, how do I do the same as WF does on the log out button on a linked button in my site, tried a few different ones from the net but none seem to quite match what I want to do, then I make them worse!!!!

I want to click my link and then an alert box says are you sure, OK / Cancel, just like the one on WF
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Mar 25th, 2008, 23:07
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,265
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: Alert Box

Easy. HTML:

HTML: Select all
<a href="logout.php" onclick="logout_confirm();">Logout</a>
javascript:

Code: Select all
function logout_confirm() {
  if(confirm("Are you sure you want to logout?"))
    return true;
  else
    return false;
}
Tell me if that works or not, didn't have a chance to test it.
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old Mar 25th, 2008, 23:16
Reputable Member
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Alert Box

Every thing works except both responses take me back to the homepage even if you click cancel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old Mar 25th, 2008, 23:19
CloudedVision's Avatar
Moderator
Join Date: Feb 2008
Location: In My Own Little World
Age: 14
Posts: 1,265
Blog Entries: 9
Thanks: 2
Thanked 40 Times in 40 Posts
Re: Alert Box

Try this out:

HTML: Select all
<a href="logout.php" onclick="logout_confirm(); return false;">Logout</a>
javascript:

Code: Select all
function logout_confirm() {
  if(confirm("Are you sure you want to logout?"))
    window.location = "logout.php";
}
__________________
Web Design And Development: Other Road Design | Problems with IE6?: KApp | My Blog: Only Nerds Allowed | Learning PHP? Lessons
Last Blog Entry: Hilarious Rapper (Jul 29th, 2008)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old Mar 25th, 2008, 23:23
Reputable Member
Join Date: Mar 2007
Location: UK
Posts: 305
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Alert Box

thanks mate
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
alert Message messing up sdbdgwood JavaScript Forum 0 Feb 8th, 2008 16:15
javascript alert ycpc55 JavaScript Forum 1 Jan 7th, 2007 02:02
One-time, IP based alert? krazykikikatt JavaScript Forum 3 Apr 5th, 2006 01:50
JavaScrip alert windows. HELP! webezine JavaScript Forum 6 Apr 21st, 2005 23:18


All times are GMT. The time now is 21:14.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42