Internet explorer return false在IE中不起作用

Internet explorer return false在IE中不起作用,internet-explorer,onsubmit,Internet Explorer,Onsubmit,我遇到了一个奇怪的小问题。在四处搜索以修复表单提交后页面的刷新后,我发现您可以使用“return false”。我很高兴看到它在FF中起作用,但当我在IE中尝试时。。。它仍然刷新了页面 这是代码的重要部分: <form action="" onsubmit="event.preventDefault(); showAddress(this.address.value); return false"> <table cellspacing="0" cellpadding=

我遇到了一个奇怪的小问题。在四处搜索以修复表单提交后页面的刷新后,我发现您可以使用“return false”。我很高兴看到它在FF中起作用,但当我在IE中尝试时。。。它仍然刷新了页面

这是代码的重要部分:

<form action="" onsubmit="event.preventDefault(); showAddress(this.address.value); return false">
    <table cellspacing="0" cellpadding="0" border="0">
        <tr>
            <td><h3>address:</h3></td>
        </tr>
        <tr>
            <td><input type="text" size="60" name="address" value="" /></td>
            <td>&nbsp;</td>
            <td><button type="submit" value="Zoek!">Zoek!</button></td>
        </tr>
    </table>
</form>

地址:
佐克!
如何确保它不会在IE中刷新

提前谢谢

编辑 我现在更改了它,所以我不再使用表单。相反,我使用按钮的onclick事件。谢谢Shin指出我的错误

<table cellspacing="0" cellpadding="0" border="0">
   <tr>
      <td><h3>address:</h3></td>
   </tr>
   <tr>
      <td><input type="text" size="60" name="address" value="" /></td>
      <td>&nbsp;</td>
      <td><button type="submit" onclick="showAddress(this.value); value="Zoek!">Zoek!</button></td>
   </tr>
</table>

地址:

您可以将preventDefault()放在提交按钮的onclick事件上。

在JS中处理按钮的onclick事件,并在JS处理程序中添加以下行

//e.cancelBubble is supported by IE - this will kill the bubbling process.
e.cancelBubble = true;
e.returnValue = false;

您可以在单击函数时调用所有函数

我尝试了这个方法,但对我来说并不奏效。页面仍会刷新。谢谢,虽然这对我不起作用,但可能是我做错了什么。这就是我要做的:函数noRefresh(){e.cancelBubble=true;e.returnValue=false;}我在onclick调用该函数,如果我错了,请纠正我,但我认为它不会将参数传递给我正在使用的javascript。我这样试过:button onclick=“showAddress(this.address.value);”但这没有任何作用,因为它没有传递参数,这是一个javascript错误,您只能使用onclick=“showAddress(this.value);”您,先生,让我的一天:现在一切都正常了。非常感谢。