Javascript代码在Firefox中不起作用

Javascript代码在Firefox中不起作用,javascript,firefox,Javascript,Firefox,在图中,单击我编写调用java的代码,如下所示 <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>New Page 1</title> </head> <body> <table cellpadd

在图中,单击我编写调用java的代码,如下所示

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>New Page 1</title>
    </head>
    <body>
        <table cellpadding="0" cellspacing="0" width="311">
            <tr>
                <td height="14">
                    <img onclick ="SignIn();" border="0" src="../images/Sign_In.gif" width="80" height="28">
                </td>
            </tr>
        </table>
        <script type="text/javascript" language="JavaScript">
            function SignIn(){
                alert();
            }
        </script>
    </body>
</html>

新的第1页
函数签名(){
警惕();
}
上面的代码在InternetExplorer中运行良好,但在FireFox中却不行。有什么问题吗?

试试这个:

{ alert(); document.getElementById('FormSignIn').submit(); } 
文档:

尝试以下操作:

{ alert(); document.getElementById('FormSignIn').submit(); } 

文档:

您需要向alert传递一个参数。当IE显示空白警报时,firefox似乎不喜欢你这样做

alert("text here");

您需要传递一个参数以提醒。当IE显示空白警报时,firefox似乎不喜欢你这样做

alert("text here");

以下是使用javascript验证web表单时应始终执行的操作示例:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>New Page 1</title>
    <!-- Inline javacript should be always inside header tag -->
    <script type="text/javascript">
    function SignIn(){
        alert("");//In firefox you have to pass something to alert to make it work


        //More code logic you can put here

        //...
        //If everything is ok return TRUE to
        //post data to "somepage.aspx" if
        // dont return FALSE and do nothin
        if(everythingIsOk);
            return true;
        else
            return false;   
    }
    </script>
    </head>
    <body>
        <form method="post" action="somepage.aspx">
            <table cellpadding="0" cellspacing="0" width="311">
                <tr>
                    <td height="14">
                        <input type="image" src="../images/Sign_In.gif" width="80" height="28" onclick="return SignIn();">
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

新的第1页
函数签名(){
alert(“”;//在firefox中,您必须传递一些消息来提醒它才能正常工作
//更多的代码逻辑可以放在这里
//...
//如果一切正常,返回真实的
//如果需要,将数据发布到“somepage.aspx”
//不要以假乱真,什么也不做
如果(一切正常);
返回true;
其他的
返回false;
}

以下是一个示例,说明在使用javascript验证web表单时应始终执行的操作:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
        <title>New Page 1</title>
    <!-- Inline javacript should be always inside header tag -->
    <script type="text/javascript">
    function SignIn(){
        alert("");//In firefox you have to pass something to alert to make it work


        //More code logic you can put here

        //...
        //If everything is ok return TRUE to
        //post data to "somepage.aspx" if
        // dont return FALSE and do nothin
        if(everythingIsOk);
            return true;
        else
            return false;   
    }
    </script>
    </head>
    <body>
        <form method="post" action="somepage.aspx">
            <table cellpadding="0" cellspacing="0" width="311">
                <tr>
                    <td height="14">
                        <input type="image" src="../images/Sign_In.gif" width="80" height="28" onclick="return SignIn();">
                    </td>
                </tr>
            </table>
        </form>
    </body>
</html>

新的第1页
函数签名(){
alert(“”;//在firefox中,您必须传递一些消息来提醒它才能正常工作
//更多的代码逻辑可以放在这里
//...
//如果一切正常,返回真实的
//如果需要,将数据发布到“somepage.aspx”
//不要以假乱真,什么也不做
如果(一切正常);
返回true;
其他的
返回false;
}
我现在遇到了这个问题。 通过清除firefox中的缓存修复: 工具>选项>高级>网络>脱机存储(缓存):“立即清除”我现在遇到了这个问题。 通过清除firefox中的缓存修复:

工具>选项>高级>网络>脱机存储(缓存):“立即清除”

也许您也可以编写HTML代码。5次编辑,没有一次修改“Internet Explore”…警报()也不起作用,把你的Javascript放在头上,你真的应该让Firebug在Firefox中调试这些类型的错误。让生活更轻松。也许你也可以编写HTML代码。5次编辑,没有一次修改“Internet Explore”…alert()也不起作用,把你的Javascript放在头上,你真的应该让Firebug在Firefox中调试这些类型的错误。让生活变得容易多了对。。我根据有限的信息做了一个假设。。真的,哎,把你的Javascript放在头上我试着用这段代码,这段代码正在运行,但警报不起作用getElementById示例函数changeColor(newColor){elem=document.getElementById(“para1”);elem.style.color=newColor;alert();}

这里的一些文本是蓝红色的,因为这个问题已经完全改变了,我将退出。我相信[车坛]有解决办法。问问你自己。。我想提醒什么(?)对。。我根据有限的信息做了一个假设。。真的,哎,把你的Javascript放在头上我试着用这段代码,这段代码正在运行,但警报不起作用getElementById示例函数changeColor(newColor){elem=document.getElementById(“para1”);elem.style.color=newColor;alert();}

这里的一些文本是蓝红色的,因为这个问题已经完全改变了,我将退出。我相信[车坛]有解决办法。问问你自己。。我想提醒什么(?)嗨,tks,这是工作。但我尝试将值传递给文档document.getElementById(“para1”).innerText=“text here”;这不起作用Firefox不支持InnerText。使用innerHTML。在firefox的每个元素中,我们使用“ID”?要传递和检索值,就像xhtml?hi tks一样,这是可行的。但我尝试将值传递给文档document.getElementById(“para1”).innerText=“text here”;这不起作用Firefox不支持InnerText。使用innerHTML。在firefox的每个元素中,我们使用“ID”?传递和检索值,如xhtml?document.getElementById(“para1”).value=“text here”;这个命令也不起作用,为什么?在firefox的每个元素中我们都使用“ID”?传递和检索值,如xhtml?document.getElementById(“para1”).value=“text here”;这个命令也不起作用,为什么?在firefox的每个元素中我们都使用“ID”?像xhtml一样传递和检索值?