una pregunta.... porque no lo haces con un Formulario de Confirmacion... yo lo hago asi... y no uso java.. solo html y php.
Código PHP:
<?php
echo <<< HTML
<table cellspacing=1 cellpadding=3 width="459" bgcolor=Black border=0>
<tbody>
<tr>
<td colspan="2" align=left bgcolor=gray width="449"><b><font color=white size=2>CONFIRMAR BORRAR:</font></td>
</tr>
<tr height="88">
<td colspan="2" align="center" valign="middle" bgcolor="gray" width="449" height="88"><br>
<form method="post" action="$pag?accion=eliminar">
<div align="center">
<input type="hidden" name="id" value="$resultados[id]">
<table align="center" cellspacing=1 cellpadding=2 width="252" bgcolor=black border=0>
<tbody>
<tr height="19">
<td valign="bottom" bgcolor="#696969" width="252" height="19">
<div align="center"><font color=white size=1>ESTA USTED CONFORME ???</font></div>
</td>
</tr>
</tbody>
</table>
<br>
</div>
</td>
</tr>
<tr height="21">
<td align="center" bgcolor=gray width="325" height="21"><input type="submit" name="Submit" value=" ELIMINAR " class="botones3"> </td>
<td align="center" valign="middle" bgcolor=gray width="117" height="21"><input type="button" value=" VOLVER " onclick="history.back()" class="botones3"></td>
</tr>
</form>
HTML;
if ($accion=="eliminar"){
echo "Aqui pones tu codigo de borrar";// aqui dentro tienes que poner tu codigo de borrar
exit;
}
?>
te lo dejo con el id, y la variable $resultados, por si quieres pasar los datos... que seguro que lo necesitaras