Browsing articles in "JavaScript"
Apr
15
2009

Font resizing using jQuery

Font Resizing is a very common feature in many modern websites. This can be done very easily with jQuery. The following script uses cookies to save the user preference, so the user preference is saved. jQuery Cookie plugin is used for managing cookie using jQuery. So include that too. the html for increase, decrease links <div> <a href="javascript:void decreaseFont();" class="font-smaller" title="Reduce font size">-</a> <a href="javascript:void normalFont();" class="font-normal" title="Normal font size">0</a> <a href="javascript:void increaseFont();" class="font-bigger" title="Increase [...]

Mar
16
2009

Disable right-click contextual menu

You can disable right-click contextual menu in your website using jQuery. Download and include jQuery library in your page and add the following code before the tag.

Feb
27
2008

File extension validation Javascript

You can use this function to validate the extension of a file, for client side file upload checkes. // You can specify the file type in the code “valid_extensions = /(.doc|.pdf)$/i;” . //If you want to add .docx supprt simply add |.docx (ex:(.doc|.pdf |.docx| .your-extension) ) var valid_extensions = /(.doc|.pdf)$/i; function CheckExtension(fld) { if(fld.value) { if (valid_extensions.test(fld.value)){ return true; } else { return false; } } else { return true; } }

Feb
26
2008

Javascript for validating a date

Javascript for validating a date. Pass month, day, year as parameters. This function will return true if the date is valid. // Author: arunmvishnu.com function validDate(month, day, year){ if(month ==’0′ || day ==’0′ || year==’0′){ return false; } switch(month){ case ’1′: //** jan case ’3′: //** March case ’5′: //** May case ’7′: //** July case ’8′: //** Aug case ’10′: //** Nov case ’12′: //** Dec if(day >=1 && day =1 && day =1 [...]

Archives

Highslide for Wordpress Plugin