PDA

View Full Version : command doesnt work


jeorg
10-29-2002, 10:31 AM
I have this function
-----------------------------------------------------

<script type="text/javascript">
function getconfirm()
{
if (confirm('Yes or No ?')==true)
{
return true;
}
Else
{
return false;
}
}
</script>

------------------------------------------------
and the command

onclick="return getconfirm();"


it doesnt work

Why ??

can I keep writting

if (confirm('Yes or No ?')==true)

in sted of

if (confirm("Yes or No ?")==true)


thank you

requestcode
10-29-2002, 01:27 PM
Try this:
<script type="text/javascript">
function getconfirm()
{
if (confirm('Yes or No ?'))
{
return true;
}
else
{
return false;
}
}
</script>

You don't need the equals true bit and you had "else" as "Else".
The "e" should not be uppercase.

jeorg
10-29-2002, 02:38 PM
it works at once !

thank you

Roy Sinclair
10-29-2002, 06:32 PM
I question the need for that function though, this should work the same way:

onclick="return confirm('Yes or No ?')"

requestcode
10-29-2002, 07:14 PM
Its possible that there is more to the function that what was shown.