Current location: Hot Scripts Forums » General Web Coding » JavaScript » script to redirect message box to URL


script to redirect message box to URL

Reply
  #1 (permalink)  
Old 10-17-08, 01:31 PM
remy_ remy_ is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
script to redirect message box to URL

Hello,

Hope somebody can help me.

How the script will be if i want to popup message box when people click a button/textlink/image on my webpage.

In the message box, i want to put some text/information for example ; Thank You!

And, when people click 'OK' button on message box, i want to redirect them to other URL for example ; http://abc.com.

Is it possible to be done?

If anybody know, appreciate if you can write a full script (javascript or what?) so that i can starting from popping up the message box till redirect to other URL.

Thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 10-17-08, 02:10 PM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
javascript Code:
  1. <script type="text/javascript">
  2. <!--
  3. function popup()
  4. {
  5.     if (confirm('Thank you!')
  6.     {
  7.         window.location = 'http://www.abc.com';
  8.     }
  9.     else
  10.     {
  11.         // User pressed "cancel"... do something?
  12.     }
  13.  
  14.     return false;
  15. }
  16. //-->
  17. </script>
  18.  
  19. <a href="#" onclick="return popup();">Click me</a>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 10-18-08, 05:10 AM
remy_ remy_ is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
thanks Nico,

i copy and paste the script into my website but when i clcik 'Click me', there is nothing happen.

can u or somebody else explain why?

again, thanks in advance.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 10-18-08, 05:18 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
My bad, a little typo. This line:
Code:
if (confirm('Thank you!')
... should read:
Code:
if (confirm('Thank you!'))
(Note the second parenthesis at the end)
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 10-18-08, 06:48 AM
dheeraj dheeraj is offline
New Member
 
Join Date: Oct 2008
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
function popup()
{
if (confirm('Thank you!'))
{
window.location = 'http://www.abc.com';
}
else
{
// User pressed "cancel"... do something?
}

return false;
}
<a href="#" onclick="return popup();">Click me</a>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 10-18-08, 11:28 AM
remy_ remy_ is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
thanks Nico,

but it still same..

after adding one more ')' symbol in the script, still nothing comes out when i click 'Click Me' on website.

can u help further?

thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #7 (permalink)  
Old 10-18-08, 02:54 PM
GurkanAlkan GurkanAlkan is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
If I understand you, this way can solve yoru problem.

First you can add a JavaScript file to your solution. And add this code to it:
Code:
function MyWindow()
{
    var pen = window.open("http://www.gurkanalkan.com","Besiktas JK","width=300,heigth=200,top=100,left=100");

}
For example you can add an HTML page to use it.
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Besiktas sen bizim her seyimizsin!!..</title>
    <script src="JScript.js" type="text/javascript"></script>
</head>
<body>

    <p>
        <input id="Button1" type="button" value="button" onclick="MyWindow();" /></p>

</body>
</html>

Last edited by GurkanAlkan; 10-18-08 at 02:55 PM. Reason: a little error
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #8 (permalink)  
Old 10-19-08, 02:53 AM
remy_ remy_ is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
sorry..i don't understand what do u mean..and what to do..

i think what Nico said is very close to what i want.
the only thing is, it still not working as intended
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #9 (permalink)  
Old 10-19-08, 03:57 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
I added the missing parenthesis, and it's working fine for me now.

Code:
<script type="text/javascript">
<!--
function popup()
{
    if (confirm('Thank you!')
    {
        window.location = 'http://www.abc.com';
    }
    else
    {
        // User pressed "cancel"... do something?
    }

    return false;
}
//-->
</script>

<a href="#" onclick="return popup();">Click me</a>

Did you change the "Thank you" text to something else?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #10 (permalink)  
Old 10-19-08, 02:04 PM
GurkanAlkan GurkanAlkan is offline
Newbie Coder
 
Join Date: Oct 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by remy_ View Post
sorry..i don't understand what do u mean..and what to do..

i think what Nico said is very close to what i want.
the only thing is, it still not working as intended
Of course my solution is not the answer you desire. It is an idea for you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Run Your Own Profitable and VERY unique eBusiness Voltaire General Advertisements 3 03-30-10 07:36 AM
Lil php coding help for url shortning script pede69 PHP 2 04-03-08 06:04 AM
message box redirect page kiko08 JavaScript 1 01-18-07 03:27 AM
Is there any integrity of script rankings? webmaster@atmanager.com Hot Scripts Forum Questions, Suggestions and Feedback 17 08-06-04 01:12 AM


All times are GMT -5. The time now is 12:33 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.