Identify an object as type of array in Javascript.
08.09.2010
Try this to determine if an object is type of jQuery. if (parameterValue instanceof jQuery) alert('true');
07.25.2010
Javascript Console-Log: Objects can be used in many ways in JavaScript. The following examples illustrate aspects of class architecture in Javascript. First of all: The execution context As described here it is allways a good idea to declare your own execution context.
07.24.2010
Categories: english | Add a Comment
/*! * jQuery Sample Plugin * * http://saquery.com * */ (function(){ $.fn.setBorderStyle = function( settings ) { var _defaults = { 'border':'solid 1px black', 'color':'red' }, _config = $.extend(_defaults, settings), _ = $(this); return _.each(function(i,n) { $(this).css(_config); }); }; })(jQuery); $(function(){ $('div').setBorderStyle(); }) Test 1 : Invoke setBorderStyle with default settings. $('div').setBorderStyle(); Invoke "Test 1" [...]
07.16.2010
The big players on the Internet offer a good possibility to include well known JavaScript libraries in your own websites. There is no need for a own webspace. This is an example to load jQuery and jQuery UI with the basic theme from Google CDN. <!DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" [...]
07.06.2010
Your own scope or execution context in Javascript is important to avoid conflicts with instanced objects and variable names. var myVar=' - context0', toTitle = function(txt){ document.title+=txt; }; (function(){ var myVar=' - context1'; toTitle(myVar); })(); (function(){ var myVar=' - context2'; toTitle(myVar); })(); toTitle(myVar); Take a look at the page title to see how this example [...]
04.04.2010
Categories: english | Add a Comment
To iterate through Javascript objects you can simply use the for each statement.