javascript redirect does work properly -


i have link displays confirm box when user click on it. if user click yes lead them specified page, otherwise stays on same page. here link , function code:

<script type='text/javascript'>    function checkdelete(){       var = confirm("are sure want delete?");       if(i){          return true;       }else{          return false;       }    } </script> <a href="operation.php?action=delete&id=<?php echo $id?>" onclick='checkdelete'>delete</a> 

the problem not stay on same page click "no" or cancel button. redirect page operation.php. if write inline javascript code on onclick works fine.

try onclick="return checkdelete();". using proper javascript expression kind of helps when try use javascript ;)

at same time, try changing checkdelete this:

function checkdelete() {return confirm("are sure want delete?");} 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -