HTML
<input id="clickMe" type="button" value="Click me to execude the script.." onclick="runmenow();"></button>
Javascript
<script>
function runmenow () {
var yesno = confirm("Welcome to the webdeveloping site" );
if (yesno == true) { alert("You clicked OK..."); }
if (yesno == false) { alert("You clicked Cancel..."); }
}
</script>
And if you have problems with the script being executed twice, then you can go this way:
<script>
function runmenow () {
var called = false;
if (!called) {
var yesno = confirm("Welcome to the webdeveloping site" );
if (yesno == true) { alert("You clicked OK..."); }
if (yesno == false) { alert("You clicked Cancel..."); }
called = true;
}
}
</script>