Java script: Add button to call function: alert, confirm,

1. Alert function
<script type="text/javascript">
function show_time()
{
alert("current time: "+ Date());
}
</script>

<input type="button" onclick="show_time()" value="click to show current"/>

2. Confirm function
<script type="text/javascript">
function show_confirm()
{
 var r=confirm("do you want to continue to unsecure site?");
if(r==true)
    {
     alert("you enter this site.");
   }
    else
    {
    alert("you don't enter this site.");
    }
}
</script>
<input type="button" onclick="show_confirm()" value="go to this site"/>

0 comments em “Java script: Add button to call function: alert, confirm,”

Post a Comment

 

Personal I.T blogs Copyright © 2011 -- Template created by O Pregador -- Powered by Blogger