List Info

Thread: Small javascript problem on firefox




Small javascript problem on firefox
user name
2006-01-03 18:51:14
I am new to javascript (and firefox).
The following code works OK on IE but has a small problem on
firefox:


<html>
<head>
<script type="text/javascript">
function disp_confirm()
{
var name=confirm("Press a button")
if (name==true)
{
document.write("You pressed the OK button!")


}


else
{
document.write("You pressed the Cancel button!")

}
}


</script>
</head>

<body>
<form>
<input type="button"
onclick="disp_confirm()" value="Display a
confirm
box">
</form>
</body>


</html>


The problem is that in IE the document.writes in function
disp_confirm()
clear the browser and write the message.  BUT..... in
firefox, they
write
their message but the browser endlessly shows as loading. 
Can anyone
tell me what will work for both? I have tried single quotes
in the
writes to 
no avail.  Thanks for any help!

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )