Archive for category JavaScript

Detect browser ExtJS way

To detect IE: if (Ext.isIE) { browser = "IE"; } if (Ext.isIE6) { browser = "IE6"; } if (Ext.isIE7) { browser = "IE7"; } if (Ext.isIE8) { browser = "IE8"; } To detect Chrome: if (Ext.isChrome) { browser = "Chrome"; } To detect Firefox: Firefox uses Gecko engine if (Ext.isGecko3) { browser = "Firefox"; } Bookmark on DeliciousDigg this post Recommend Read More

Calling Javascript in XForm

We can call javascript from XForm using xform:load tag. The following example calls the javascript function named helloscript. <xforms:trigger> <xforms:label>Launch JS</xforms:label> <xforms:load resource="javascript:helloscript()" ev:event="DOMActivate"/> </xforms:trigger> Bookmark on DeliciousDigg this post Recommend on FacebookShare with StumblersTweet a Read More

Tags: ,

Javascript – get elements by class

function getElementsByClass(searchClass,node,tag) { var classElements = new Array(); if ( node == null ) node = document; if ( tag == null ) tag = ‘*’; var els = node.getElementsByTagName(tag); var elsLen = els.length; var pattern = new RegExp(“(^|\\s)”+searchClass+”(\\s|$)”); for (i = 0, j = 0; i < elsLen; i++) { if ( pattern.test(els[i].className) ) { classEleme Read More

Tags: