Tizag Webmaster Forums  

Go Back   Tizag Webmaster Forums > Web Development > General Web Design

Reply
 
Thread Tools Display Modes
  #1  
Old 10-01-2009, 12:05 PM
root root is offline
Curious Visitor
 
Join Date: Oct 2009
Posts: 4
root will become famous soon enough
pop up

Hi there
Hope you all are well.

I have a few forum on my website, and want to put a confirmation popup on the links on my site

I just want a pop that ask the user if he is sure he want to leave this page without submitting the form?

with a Yes and No button.

the yes button should just send him to the link, and the no button should keep him on the current page.

Any help will be great!

Root
Reply With Quote
Sponsored Links
  #2  
Old 10-01-2009, 12:40 PM
Janek Janek is offline
Graduate Student
 
Join Date: Aug 2008
Location: Minsk, Belarus
Posts: 848
Janek is a jewel in the roughJanek is a jewel in the rough
HTML Code:
<html>
<head>
	<title>Untitled</title>
	<script type="text/javascript">
function redirect() {
	if(confirm('Do you want to leave this page?'))
		location='url to redirect'
}
</script>
</head>

<body>
<h1>redirect</h1>

<form>
The body of your form<br>
<input type='button' value='Redirect' onclick="redirect()">
</form>
</body>
</html>
Good luck.
Reply With Quote
  #3  
Old 10-01-2009, 01:24 PM
root root is offline
Curious Visitor
 
Join Date: Oct 2009
Posts: 4
root will become famous soon enough
Thanks for the reply.

I would like "onclick="redirect()"" to be on a link on my site and not a button.

And the "location='url to redirect'" must be he location of the link you click on.

Thank for the help, I am a new at this, and not very good :-(

Root
Reply With Quote
  #4  
Old 10-01-2009, 02:46 PM
greatstar00 greatstar00 is offline
Graduate Student
 
Join Date: Sep 2007
Posts: 882
greatstar00 has a spectacular aura aboutgreatstar00 has a spectacular aura about
HTML Code:
<html>
<head>
	<title>Untitled</title>
	<script type="text/javascript">
function redirect() {
	if(confirm('Do you want to leave this page?'))
		return true;
             else
                          return false;
}
</script>
</head>

<body>
<a href="http://use4free.co.cc" onclick="return redirect()">Go here</a>
</body>
</html>
__________________
Free webspace to test php/mysql (keep backup)
MySQL Host: sql305.0lx.net >FTP Server: ftp.0lx.net >DB name: 0lx_4217081_testdb
FTP/SQL User: 0lx_4217081 >FTP/SQL Password:123456
Website URL: use4free.co.cc (upload to folder "htdocs")

Last edited by greatstar00; 10-01-2009 at 02:49 PM.
Reply With Quote
  #5  
Old 10-02-2009, 01:38 AM
root root is offline
Curious Visitor
 
Join Date: Oct 2009
Posts: 4
root will become famous soon enough
Thumbs up

Thank you.

It's working 100%
Reply With Quote
Reply

Thread Tools
Display Modes

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

Forum Jump


All times are GMT -6. The time now is 07:34 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 2008, Tizag