My first ever attempt at JavaScript, so please be gentle with me . . .
I have "Buy Now" buttons on my page and I want to alert certain buyers that the product may not be suitable for their location.
This is what I've come up with so far but if the buyer clicks "YES" I want the "Buy Now" button to activate (not necessarily with a window alert).
If they click "NO" I want to cancel the action and return a "CANCELLED" message of some sort.
<html>
<head>
<script type="text/javascript">
function message()
{
var x=window.confirm("Make a decision - YES or No")
if (x)
window.alert("Yes goes ahead with button action")
else
window.alert("No cancells the button action and displays a cancellation message.")
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" onclick="message()" />
</form>
</body>
</html>
Can anyone help me please?