Posts tagged: javascript

DebugBar – Debugging Internet Explorer (IE)

DebugBar provides a nice, simple Javascript console for IE. Does a little better on telling you where problems are too.

Firefox – Enable/Disable Javascript Caching

To enable/disable Javascript caching in Firefox in about:config:

network.http.use-cache = true/false

Javascript Debugging

Advanced JavaScript Debugging Techniques provides a set of useful suggestions on Javascript debugging techniques.

An interesting note in one comment about a Javascript debugging environment for Windows – “If you are on MS Windows and need to debug javascript in Internet Explorer you should give a try to VWD (Visual Web Developer Express Edition).”

The JavaScript Source: Debugging Guide provides a list of common errors.

Firebug – Debugging Javascript

Firebug JavaScript Debugger and Profiler does a nice job of explaining basic debugging techniques for Javascript in Firebug. Remember to switch to the ‘Script’ tab.

Javascript Compression

Rhino dojo javascript compression

http://svn.dojotoolkit.org/src/util/trunk/shrinksafe/shrinksafe.jar

http://svn.dojotoolkit.org/src/util/trunk/shrinksafe/js.jar

java -jar shrinksafe.jar infile.js > outfile.js

Javascript – Same Origin Policy

https://developer.mozilla.org/En/Same_origin_policy_for_JavaScript

Javascript to find selected options

function findSelectedOptionsAsString(current_select) {
  var selected_options = findSelectedOptions(current_select);
  var selected_options_string = new String();
  for (var selected_option = 0 ; selected_option < selected_options.length; selected_option++) {
    if (selected_option == 0) {
      selected_options_string = selected_options_string + selected_options[selected_option];
    }
    else {
      selected_options_string = selected_options_string + " " +   selected_options[selected_option];
    }
  }
  // debugMessage("Selected options: " + selected_options_string);
  return selected_options_string;
}

function findSelectedOptions(current_select) {
  var select_options = current_select.childNodes;
  var num_select_options = select_options.length;
  var selected_options = new Array();
  for (var current_option_pos = 0; current_option_pos < num_select_options; current_option_pos++ ) {
    var current_option = select_options[current_option_pos];
    if (current_option.nodeName == "OPTION") {
      if (current_option.selected == 1) {
        var current_option_value = current_option.getAttribute("value");
        if (current_option_value != null) {
          selected_options = selected_options.concat(current_option_value);
        }
      }
    }
  }

/*
if (selected_options.length != 0) {
  for (var selected_option = 0 ; selected_option < selected_options.length;   selected_option++) {
    debugMessage(selected_options[selected_option] + " selected");
  }
}
*/
  return selected_options;
}

WordPress Themes