Javascript Titbits

  • Putting () after a function/method causes it to run…without the parenthesis a reference to the function is passed around.)
  • function functionName (parameterList){ statementList } is the same as window.functionName = function(parameterList) { statementList )
  • IE implements an incorrect version of add() for select dropdowns-
    var option = new Option(info[0], info[1]);
    selectList[0].add(option, null);
    is broken, rather you have to do:
    var option = document.createElement("option");
    option.text = info[1];
    option.value = info[0]
    selectList[0].options.add(option);

Category: Web Development Comment »


Leave a Reply



Back to top