Javascript help

Author
Discussion

KITT

Original Poster:

5,339 posts

242 months

Thursday 17th March 2005
quotequote all
I'm trying (and failing!) to get the confirm function working under anything other than IE. My code is as follows:
I wrote said:
< script language="Javascript">
function AreYouSure() {
if (confirm("Do you really want to do this?"))
DeleteForm.submit();
else
return false;
}
< /script>

< form action="deletestuff.php" method="post" name="DeleteForm">
.
.
.
.
.
.
< table border="0">
< tr>
< td width="4" background="but4.gif">< /td>
< td background="but5.gif" class="PicButton" onclick="AreYouSure();">< font color="#222222">Delete selected< /font>
< /td>
< td width="4" background="but6.gif">< /td>
< /tr>
< /table>
< /form>
I've had to put a space infront of all the html tags as PH seems to strip them off

This works fine under IE but the form won't sumbit under Netscape or Firefox.

Any suggestions?

KITT

Original Poster:

5,339 posts

242 months

Thursday 17th March 2005
quotequote all
Cheers Mark but I think I should have added that the dialog asking you to "ok" or "cancel" the request does appear in Netscape, but when you click "ok" nothing happens (i.e. the form does not get submitted). Any more ideas folks

KITT

Original Poster:

5,339 posts

242 months

Thursday 17th March 2005
quotequote all
robbieduncan said:
Could be a scope problem. try document.DeleteForm.submit()
Excellent! That's what the problem was! Many thanks