Recommended:

  • phpclasses.org
  • jsclasses.org
  • jsmag.com
  • siteapps.com
  • View our reviews on Hot Scripts
  • JS Tutorial
  • scripts.com
  • securesignup.com




Recent Comments

Powered by Disqus




WebGL Game Development

2014-06-20

  For some time I’ve been involved in a Project, great part of which consists of OpenGL rendering engine. And although my part of the job was completely unrelated to it, on occasions I needed to dive into that code and try to understand what it does and extend it’s functionalities (copying buffers for making screenshots,...

Comments Read more

Apply anaglyph 3D filter using Javascript

2012-09-10

Anaglyph3D class creates a stereoscopic 3D effect for images or texts by means of encoding each eye's image using filters of different colors . It is possible to specify color filters for each eye to use, thus adapting image or text for all type of anaglyphic glasses. Package contains anaglyph3d.js and anaglyph3d.packed.js (packed...

Comments Read more

Protect your content

2011-07-04

Although there is no way to completely protect your content, atleast you can do something to make it harder. This restrictions are sometimes mandatory for different websites, so here are the tips how you can protect your content using javascript. So it is possible to: disbale right click of the mouse and...

Comments Read more

Get scroll position of webpage - crossbrowser

2011-05-20

Here is a function to get scroll position of current webpage: <script type='text/javascript'> //get scroll position var get_scroll = function(){ var x = 0, y = 0; if( typeof( window.pageYOffset ) == 'number' ) { //Netscape compliant y = window.pageYOffset; x = window.pageXOffset; } else if(...

Comments Read more

Prevent default event behavior - crossbrowser

2011-05-20

With almost each javascript event there is a default behavior that is followed after event's been fired. For example, if you click on a link, you can do stuff provided in onclick event, and then you'll be redirected to provided URL. Not all event behavior can be prevented, usually it can be determined using event.cancelable...

Comments Read more

Get relative cursor positions

2011-04-13

Every browser support clientX and clientY mouse event properties to get cursor position relative to screen you see. If you'd like to get cursor position relative to whole page (counting scrolling position), it could be done using this function: function get_page_coord(e) { //checking if pageY and pageX is already available if...

Comments Read more

Javascript events - crossbrowser

2011-02-27

Here's a two useful functions to manipulate events in javascript. First one allows you to add new event. And second one will return you element, which fired event. //add event var add_event = function(element, type, listener){ if(element.addEventListener) { element.addEventListener(type, listener, false); } ...

Comments Read more

Crossbrowser viewport size

2011-02-27

This function allows you to get viewport dimensions (width and height). Viewport is an area that is available for webpage, that is screen resolution - toolbars etc. //get viewport size var viewport = function(){ var viewport = new Object(); viewport.width = 0; viewport.height = 0; // the more standards compliant browsers...

Comments Read more

Cursor positions and text selections

2011-01-08

For each input in every modern browser there are properties like selectionStart and selectionEnd using which we can easily manipulate cursor position and text selection. Every browser except IE.  In IE you will have to deal with text ranges and there is no united way for textareas and input methods, so we'll need to create separate...

Comments Read more

Rate content using stars

2011-01-05

Here are some javascript functions, that will allow your visitors to rate your content by clicking on stars. We will use same stars, that are used in display rating using stars article. So what we will do, is define two CSS classes with full star and empty star. Then create 3 javascript function. One for onmouseover event that will change...

Comments Read more

Get document dimensions (cross browser compatible)

2010-11-13

Here are two javascript functions to get document dimensions, which works in all popular browsers. Basic idea is to check all possible values in all possible combinations and take maximal value, so if in one browser this value is undefined, it will be interpreted as 0 and could never be maximal value. Here is a code snippet of those...

Comments Read more

Get password behind asterix when auto filling forms

2010-11-09

Using different passwords for different websites is almost mandatory nowadays, but it is also pretty hard to keep track of all passwords, so people usually use form fillers. Either it is a built in webrowser or plugin, or standalone application, you just save password once and then auto fill login form without even remembering your password....

Comments Read more

Notify users about Caps Lock on while logging in

2010-10-16

For security measures in every login form you can't see password which you are entering, thus you don't know if you enter it right. Of course there is a probability that you miss typed it, and that's why you can't log in. But what if you type it for the third time, and you know that you typed the right password? Well then...

Comments Read more

Function to create table with specified ASCII symbols

2010-07-25

Here is the function, that create table with ASCII symbols from specified ASCII code interval. You can modify it's size and use different styles, onclick function etc. It takes 3 parameters, ID of div element where to attach table, start of ASCII code and end of ASCII code. <div id='chartable'> </div> <script...

Comments Read more

Select all checkboxes in form

2010-07-21

Here is a piece of code that will allow you to select all checkboxes in specified form, like you can do it in your email account  - select all emails. It takes form id as parameter <script type='text/javascript'> function select_allch(id) { var form = document.getElementById(id); var inputs =...

Comments Read more

Javascript function to check if value is number

2010-07-10

Here is the function, that checks if value is numeric. You can edit valid variable to add more symbols, like "." to check for float numbers or add any other allowed symbols. function is_number(val) { var valid = "0123456789"; var number = true; var symbol; for (i = 0; i < val.length && number ==...

Comments Read more

Javascript multiple file download queue

2010-07-02

This piece of code allows you to force users to download multiple files one by one using javascript. It can be used to simply download files or use it combination with PHP force download. Although javascript opens file in new window, thus forcing open/save dialog box, it might not work in all browsers. So you may want to modify it to link file...

Comments Read more

Updating countdown every second using javascript

2010-06-21

Here is a code example how to update countdown on your website every second. You only need to setup start time. <p> <span id='years'></span><span id='y'> years </span> <span id='months'></span><span id='m'> months </span> <span id='days'></span><span id='d'> days...

Comments Read more

Mirrored text

2010-06-12

Function that not only reverses string, but reverses each line of string, so it looks exactly like in mirror. Check here for example: http://mirrored-text.co.cc/ function rorrim() { reversed = document.getElementById('text').value; revertext = reversed.split(""); revertext = revertext.reverse(); reversed =...

Comments Read more

How to embed flash objects

2010-05-20

The best way to embed flash object is using SWFObject javascript library. It automatically checks if visitor has flash player, what version, displays corresponding message, and you don't have to worry about those things. To use SWFObject, you need to include javascript library in your <head> tags, then create div, which will...

Comments Read more



1 2