Forum Moderators: open

Message Too Old, No Replies

simple form script works in FF/opera, not in IE6

         

babil

1:05 pm on Nov 15, 2006 (gmt 0)

10+ Year Member



Hello all,
this is the code.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<script>
<!--
function alertFunction(pid) {
var myname="let";
var xyz = pid;
var x=window.confirm("Möchten Sie den Eintrag löschen?");
if (x) {
window.document.getElementById('id_tst').setAttribute('value',xyz);
window.document.getElementById('test').submit();
}

}
//-->
</script>
<title>Untitled</title>
</head>
<body>
<?php
if ($_POST['let']) {
echo $_POST['let'];
}
?>
<form id="test" action="test.php" method="POST">
<input type="hidden" name="let" id="id_tst" value"">
<?php
for ($i=1;$i<5;$i++) {
echo '<a href="javascript:;" onClick="alertFunction('.$i.');">Eintrag löschen</a><br>';
}
?>

</form>
</body>
</html>

In FF/opera it works and php echos the POST variable. In IE6 , I get the confirmation window, but the form is not proccessed.
Any ideas?
Thanks in advance
babil

babil

2:37 pm on Nov 15, 2006 (gmt 0)

10+ Year Member



Ok, I figured it out. For whatever reason I had to add return false in my link.

echo '<a href="javascript:;" onClick="alertFunction('.$i.');return false;">Eintrag löschen</a><br>';

cheers