Firefox中未定义函数的Javascript错误 [英] Function Not Defined Javascript Error in Firefox

查看:110
本文介绍了Firefox中未定义函数的Javascript错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JavaScript时遇到问题,该问题似乎可以在IE中正常运行,但不能在Mozilla Firefox中运行.

以下是这种JavaScript代码的简单示例:

I have a problem using JavaScript that seems to function properly in IE but not in Mozilla Firefox..

Following is a simple example for that kind of JavaScript code:

<head>
    <title>Helo World</title>
        <script type='text/javascript'>
            function ShowSelection() {
        try{
            alert('Your selection is ' + SelectColor.value);
            BodyContent.style.backgroundColor = SelectColor.value;
            }
            catch(e){alert('An error has occurred: '+e.message)}
    }
    </script>
</head>
<body>
    <div id="BodyContent">

        <hr />
         Select a color theme:
        <select id="SelectColor">
            <option value="white">White</option>
            <option value="yellow">Yellow</option>
            <option value="silver">Silver</option>
        </select>
        <input id="SelectionBTN" type="button" value="Select" onclick="ShowSelection()"  />
     br mode="hold" />  </div>
</body>
</html>



您可以尝试一下,并且可以看到使用IE可以正常工作,但不能使用Mozilla Firefox .在Firefox中,出现错误,提示功能未定义".为什么?



You can try this and you can see EVERYTHING WORKS FINE WITH IE, but NOT with Mozilla Firefox. In Firefox it gives an error that saying "function is not defined". Why? How to fix it??

推荐答案

由于FF存在问题,您是否熟悉 firebug [ ^ ]?如果没有,为什么不自己进行调试.这是一个很棒的javascript调试工具,我相信您会喜欢的.
Since you are having a problem with FF, are you familier with firebug[^]? If not why not get it and debug it yourself. It is a great javascript debugging tool, I am sure you will like it.


这篇关于Firefox中未定义函数的Javascript错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆