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

Network Topologies (Tutorial-4)

Topology refers to the way in which the network of computers is connected. The choice of topology is dependent upon--- Type and number of equipment being used  Planned applications and rate of data transfers  Required response times  Cost Types of Network Topologies Physical Topology: Physical topology defines how devices are connected to the network through the actual cables that transmit data(physical structure of the network)  Logical Topology: Logical Topology (also referred to as Signal Topology) is a network computing term used to describe the arrangement of devices on a network and how they communicate with one another.

Cisco Hierarchical Model

Cisco Hierarchical Model Defined by Cisco to simplify the design, implementation, and maintenance of responsive, scalable, reliable, and cost-effective networks. The 3 layers are logical and not physical – there may be many devices in a single layer, or a single device may perform the functions of 2 layers, eg: core and distribution. The Cisco Hierarchical Model

Windows 7 transformation pack for xp

As the windows 7 launched after that there are lot of screenshot available on the internet, There developer designed the transformation packs for xp to make it better lo0king like windows 7. There are some transformation packs for your xp. Download Vienna 2.5 – Windows 7 Transformation Pack (Mirror) Downloa d HFN Windows 7 Transformation Pack Download Windows 7 Transformation pack – NSFormation (Mirror) Download Vienna Transformation Pack v1