HELP!!! - Dynamic page link - Javascript prompt???


#1

This is a link in a recordset page, to delete a record, which is alongside every record displayed in the recordset.

How can I make the link call a Javascript confirm command, to prompt the user if they want to go to the page or not?

Delete


#2

PHP wise, you just echo the appropriate Javascript to the page.

This is PHPhelp, For Javascript help, Might I suggest http://www.webmasterworld.com/forum91/ (Thanks to Carella for this link)


#3

Javascript isnt my thing, but I can answer this one as I think:

Joh, add the following to your head tags:

function confirm()

{

var confirmSub = confirm(“Are You Sure?”);
if (confirmSub) { return true; } else { return false; }

}

Then in your link do the following:

Delete

Hope that helps. I actually got the code from someone on Webmaster World in the first place. :P


#4

To add to what carella said you will need to have the following:

<script>
function confirm() 

{ 

var confirmSub = confirm("Are You Sure?"); 
if (confirmSub) { return true; } else { return false; } 

} 
</script>

You need the script tags to tell the browser that it is javascript.


#5

Thanks Ragster00, forgot the script tags. :)