js function causing all other functions not to work inside js file

Posted by Camran on Stack Overflow See other posts from Stack Overflow or by Camran
Published on 2010-05-10T17:33:22Z Indexed on 2010/05/10 17:44 UTC
Read the original article Hit count: 178

Filed under:
|
|
|

In safari 4 and all explorer browsers, whenever I try to call a function inside a javascript file which contains this function below, that first function isn't called.

So calling function1 will not work if function2 is inside the same .js file, explanation?

Here is the code which makes the problem. Whenever I remove this function, everything works fine and all functions work fine. So this function is causing a problem.

 function addOption(selectbox, value, text, class, id_nr )
 {
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
optn.id = value;
if (class==1){ optn.className = "nav_option_main"; }
selectbox.options.add(optn);
 }

Any ideas why?

Thanks

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about html