Virtual Species

Style Odd or Even DIV Using jQuery


DIV 1
DIV 2
DIV 3
DIV 4
DIV 5
DIV 6
DIV 7
DIV 8
DIV 9
DIV 10

Compare unescape(), decodeURI(), and decodeURIComponent()


unescape() Method
     Test characters: ~!@#$%^&*=+(){}[],?/:;'\"\\
We know that escape() method returns a string of the argument with all spaces, punctuation, accented characters and any non-ASCII characters replaced with %HexNumber. The function unescape() does simply the opposite. It takes the encoded version of a string and reverse the string back to its decoded original state. By the way, both of these methods does not work with Unicode strings and both have been deprecated. The syntax of this function is_
     unescape(string);
For examine, using escape() on the Test Characters will give the following encoded string. Using this encoded string in the input box and decoding will return the original Test String.
     %7E%21@%23%24%25%5E%26*%3D+%28%29%7B%7D%5B%5D%2C%3F/%3A%3B%27%22%5C

Compare escape(), encodeURI(), and encodeURIComponent()


escape() Method

The escape() function computes a new string in Unicode format where certain characters have been replaced by a hexadecimal escape sequence. It encodes all the spaces, punctuation, accented characters, and any other non-ASCII characters. It doesn't encode all the special characters, such as @*_+-./. It replaces characters with %xx encoding, where xx is equivalent to the hexadecimal number representing the character. For example, # is returned as %23.
Test characters: ~!@#$%^&*=+(){}[],?/:;'\"\\

Display Alphabets by setInterval() Function


HTML Code Decoder

We talked about HTML encoding and create a handy tool on HTML Code Encoder post. We talked about why encoding is important and why we can't ignore that. However, decoded HTML code is also needed in many cases. Specially, we need to decode our old code to update or modify to make it more user friendly. If we want to update our cool project on blog or site, we need a decoder for encoded code.



Check out HTML Code Encoder.

HTML Code Encoder

Encoding HTML code is important in many cases. We know that browsers may get the encoding wrong. Symbols might get mixed up or might show as unknown character. Encoding data converts potentially unsafe characters into their HTML-encoded equivalent. If you just paste 3 byte characters of some encoding into your HTML code without escaping them, things might get ugly. Its good habit to encode your HTML code. Below is a little tool to help you out. Copy your HTML code in the textbox, encode using encode button and click or focus the textbox to select encoded version of your code to copy. Its that simple!



Check out HTML Code Decoder.

JavaScript setInterval() Method

JavaScript setInterval() method either call a function evaluates an expression at specified number of milliseconds. This method continues to call/evaluate the expression until window is called. Another way to stop this method is by calling clearInterval() method. Below is a working demo of this useful method.

Hit start..

JavaScript Output

There are several ways to generate output in JavaScript. Each and every scenario depends on our need. These are_

     innerHTML
     document.write()
     console.log()
     window.alert()

Click Count with JavaScript


Button was clicked - 0 - times.


     The above click event can easily be triggered by a little script. We can use that for our blog or in web game to collect click. Check out the following script_

     Here we used getElementById() to get certain elements and set an onClick() attribute and incremented the count number. This the most easiest way to get this task done. However, there are so many other ways too.

Move Image with JavaScript

What it can't do? Well, I was talking about jQuery. It is a tremendous library. CSS wasn't able to create complex animations at some point, and then jQuery appeared to help it out. jQuery created a wrapper method, called animate(). It can apply custom animation to the elements in the set. It provides a set of CSS style properties that they can reach the end of the animation. By the way, only numeric values are allowed to be animated, such as left: "+=350" in our case. String values cannot be animated like background-color:black, except for the strings "show", "hide" and "toggle". These values only allow hiding and showing the animated element. There is a working example below_

Explore the Blog...arrow

How to Print Contents from Certain DIV

Time to time we get into such situation when we need to print part of our webpage where pop-up is restricted. Well JavaScript will be the answer. Here is a little script that raise the DIV dynamically and print. It is very effective cross browser script. Feel free implementing it as a starter..

Grab The Button...

Grab the above button and add to your blog or website to get easy access to Virtual Species. Simply click the textbox, copy the code and paste where you want to see the button. That's it!

About Author...

My photo

Technophile and believer of 'Be the Change to Change the World' _(Try to ♲)