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 Sergey Alexandrovich Kryukov 404
1 Nirav Prabtani 307
2 Abhinav S 210
3 PIEBALDconsult 160
4 Dave Kreskowiak 155
0 OriginalGriff 7,580
1 Sergey Alexandrovich Kryukov 6,806
2 Maciej Los 3,919
3 Peter Leow 3,693
4 CHill60 2,742


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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100