Skip to main content

How To Redirect With Javascript Alert Box

Javascript is basically used for validation of forms by using alertbox.We can use javascript alertbox to Re-direct user to new web page with his/her permission. If you need that user must give his/her responce before re-direction then this technique is going to be usefull too for you. You can use it to recheck user's choice.
As we know javascript is basically a function that perform its task, we call this function on button with firing a click event named "onclick( )". We give function name into empty parantheses and apply it on button.
When user press button this function  is called and javascript runs.
Here is the given code.........

 Code:

<html> <head>
</head>
<body>
<p>Press button to see alert box</p>
<input type="button" onclick="myfunction()" value="Google">
<script type="text/javascript">
function myfunction()
{
var r;
r=confirm("Do you really want to go to this address ?")
if (r==true)
{
window.location = "http://www.google.com/";
}
else
{
alert("Thanx for not leaving us")
}
}

</script>
</body>
</html>

Please give your feedback, it will help us to enhance the quality of our matter.

Comments

Popular posts from this blog

Eden: PHP Library To Get Things Easy For PHP Developer

Eden is PHP Library designed for helping developers in their rapid development work. In Our most of the project we have to integrate our developed website or application with most of  the social networking websites like Google, Facebook, Twitter, yahoo etc. so what we do is we integrate libraries of different websites differently Although We could make the code reusable but still if the websites increases then confusion will also increases. Adding different libraries form different sources add more complexity to your project and ends up to be hard to maintain. Eden simply a set of reusable components, that works with any PHP framework and CMS. Eden makes code logical and readable with dead simple syntax. Eden Will work With Most Of Web services including Amazon Web service Facebook Foursquare Google twitter tumbler Paypal Yahoo You could Download the File From  Eden Official Website  and Can use this will just a simply including this...

OSI Model (Tutorial-6)

What is the OSI model ? Open Systems Interconnection model is fundamental to all communications between network devices.  Developed in 1974 by ISO after the American Department of Defence began using the TCP/IP suite of protocols.  Finally adopted in 1977. It is now the theoretical model for how communication takes place between network devices. What are the seven layers ? Layers OSI Model Layer 7  Layer 6  Layer 5  Layer 4  Layer 3  Layer 2  Layer 1

CISCO System & Certifications

CISCO Systems Corporation: CISCO Systems is a large corporation that produces computer networking products and services. The Linksys brand of consumer networking products is also an owned subsidiary of CISCO Systems.