Glaanieboy
OSNN Veteran Addict
- Joined
- 6 Mar 2002
- Messages
- 2,628
Code:
<html>
<head>
<title>Javascript Test</title>
<script language="text/javascript">
function jumpTo(confirm_text,alert_text,url){
if(confirm_text){
if(confirm(confirm_text)){
location.href = url;
}else{
if(alert_text){
alert(alert_text);
}
}
}
}
</script>
</head>
<body>
<a href="javascript:void(0);" onClick="javascript:jumpTo('Confirm this','ALERT!','http://www.whatismyip.com');">Click me</a>
</body>
</html>
This piece of HTML/javascript should display a text in a confirm dialog and when canceled it should display the alert box. But when I click the 'Click me' link, it does nothing. What is wrong with this piece of code?