Code blocks are created by indenting at least 4 spaces
... and can span multiple lines

<script>
function del(delUrl) {
var r=confirm("Are you sure you want to delete?");
if (r==true)
  {
  alert("Deleted record!");
  document.location = delUrl;
  }
else
  {
  alert("Delete cancel!");
  }
}
</script>



<a href='delete.php?id=$sysid' class='view' onClick='del()'>
                    <img src='image/vie.png' border='0'>
                </a>

can someone tell where im wrong to this javascript...
this code pass the id=$sysid to the delete.php but before to pass i make dialogbox yes and no.
but this code alway sent me to the next page. help plsssss

guys help me to my project please! thanks in advance :D

Member Avatar for Avenirer

Try this

<a href='JavaScript:void(0);' class='view' onClick='del("delete.php?id=$sysid")'>
                <img src='image/vie.png' border='0'>
            </a>

Hi,

if this-> $sysid is a php variable, then try changing your code

<a href='delete.php?id=$sysid' class='view' onClick='del()'>
<img src='image/vie.png' border='0'>
</a>

to this

<a href='delete.php?id=<?php echo $sysid;?>' class='view' onClick='del()'>
<img src='image/vie.png' border='0'>
</a>

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.