Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript HTML Firefox
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>
 
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??
Posted 17-Mar-11 8:53am
Comments
AlbinAbel at 17-Mar-11 15:17pm
   
Which version of firebox it is?. if it is older version then you may need to use the document.getElementById method

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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.
  Permalink  
Comments
Espen Harlinn at 17-Mar-11 19:34pm
   
Good advice, my 5
Yusuf at 18-Mar-11 8:45am
   
Thanks, Firebug is simply amazing

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Maciej Los 589
1 OriginalGriff 379
2 CPallini 205
3 RyanDev 175
4 Sergey Alexandrovich Kryukov 160
0 OriginalGriff 5,689
1 Sergey Alexandrovich Kryukov 4,783
2 Peter Leow 2,954
3 Maciej Los 2,819
4 DamithSL 2,465


Advertise | Privacy | Mobile
Web01 | 2.8.140718.1 | Last Updated 17 Mar 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid