Category Archives: Javascript

Javascript: Get Emelents By Class

// Example: // var els = getElementsByClass(document, ‘cool_row’, ‘ ‘); // var elsLen = els.length; // for (i = 0; i < elsLen; i++) { // els[i].style.display = ""; // this // } function getElementsByClass(node, searchClass, tag) { var classElements … Continue reading

Posted in Javascript | Leave a comment

Javascript – Match with Regular Expression

var reg_exp = /^([0-9]+)\/([0-9]+)$/; var matches = month_value.match(reg_exp); The variable matches is an array. Note the escaping for the character /.

Posted in Javascript | Tagged | Leave a comment

Javascript – default value in function arguments

Javascript doesn’t support default arguments for function. But you can implement this feature using the function arguments this way: // the second parameter ‘submit’ is as it has ‘true’ as default value // the second parameter ‘submit’ is as it … Continue reading

Posted in Javascript | Leave a comment

HTML: Readonly checkbox

<input onclick=”javascript: return false;” name=”my_name” type=”checkbox” value=”yes” />

Posted in HTML / CSS, Javascript | Leave a comment

Javascript foreach equivalent

var arr = ['uno', 'due', 'tre']; for (var i in arr) { alert(arr[i]); } var is very important, otherwise you’ll get an error in IE.

Posted in Javascript | Tagged , | Leave a comment

Secure Login without SSL – using Javascript MD5 library

http://iamjosh.wordpress.com/2008/03/18/encrypting-login-password-without-ssl-in-ruby-on-rails/ http://pajhome.org.uk/crypt/md5/

Posted in Javascript, Security, Web Dev Security | Leave a comment

Hiding Your Email Address In Webpages

It takes the email address as input and generates the Javascript code to print the email address in the page in a hard-to-read-by-a-bot way. It splits the email address in some three-character long chunks. I was in a hurry while … Continue reading

Posted in Javascript, PHP, Web Development | Leave a comment

Get And Set The Selected Value In a Combobox

Just use the selectedIndex property.

Posted in HTML / CSS, Javascript | Leave a comment

Scriptaculous | Facebook-like Text Input | Multiselect With Autocompletion

http://www.interiders.com/2008/02/18/protomultiselect-02/

Posted in Prototype / Scriptaculous | Leave a comment

Protoculous – Prototype + Scriptaculous Compressed

http://protoculous.wikeo.be/

Posted in Prototype / Scriptaculous | Leave a comment