Page 1 of 1
alert onclick
Posted: Thu Oct 27, 2005 4:08 am
by shiznatix
this is easy but i am the worst at javascript. i want when you click on a link that it will alert saying "you sure you want to delete $variable_name" where variable name is the name of a hidden field. then if they click yes it continues with what it would do but if they click no then it stops and does not go to the link.
Posted: Thu Oct 27, 2005 6:11 am
by Chris Corbyn
Code: Select all
<script type="text/javascript">
<!--
function askOK()
{
if (confirm('Dude! You sure you are OK with this??!')) return true;
else return false;
}
// -->
</script>
<a href="somewhere_bad" onclick="return askOK();">Click me</a>
Posted: Thu Oct 27, 2005 6:42 am
by shiznatix
oh ok that was easy enough. thanks
Posted: Thu Oct 27, 2005 11:45 am
by shiznatix
this confirm command does not work, infact it does nothing. it just goes to the link straight away. hummmm
edit: ahha javascript does not work when you have javascript turned off... hummmmmmm
Posted: Thu Oct 27, 2005 12:07 pm
by Chris Corbyn
shiznatix wrote:edit: ahha javascript does not work when you have javascript turned off... hummmmmmm
I've done that before now.... I thought I was going mad and then I realised what I was doing

Posted: Fri Oct 28, 2005 1:47 am
by n00b Saibot
shiznatix wrote:ahha javascript does not work when you have javascript turned off... hummmmmmm
hey, thats new to me
