Posts: 219
Location: UK, East Anglia
|
i know very little javascript so i might not make much sense 
i have this which activates the javascript when someone clicks the link:
<a href="shop.php?id=1&item=5" onclick="buy()">item</a>
and this is the javascript thats in the head of my page,
<script type="text/javascript">
<!--
function buy() {
var answer = confirm("Are you sure you want to buy this item?")
if (answer){
} else{
window.location = "shop.php?id=1";
}
}
//-->
</script>
How do i make it so when the person clicks ok they will go to the page in the link(shop.php?id=1&item=5) and if they click cancel they will stay on the same page (shop.php?id=1)
Last edited by timsquash5 : 03-10-2005 at 01:22 PM.
|