Archive for the javascript Category
CSS Properties To JavaScript Reference Conversion
Heya Peeps, Today one of my colleague was stuck in very basic Javascript function, in which he was trying to change the font-size of a paragraph by tweaking the CSS "font-size" property with the help of a Javascript function. His code was perfect but with one problem, that was proper reference of
Read Full PostSleep or wait function in javascript
Always wondered that why does Javascript do not have some extraordinary functions like trim, wait, sleep etc. Oh well, i think at that time they din bother to add them or din feel the requirement. I was working on a script last week and somehow i wondered if i can trick around such that my Java
Read Full PostAdd user specific replies in wordpress comments
Always wondered how to leave a reply to specific comments or a thread like replies. Well wordpress made it very simple for you. The function wp_list_comments accepts various useful parameters . There is one parameter called max_depth which is going to do the trick for you. If you open your themes
Read Full PostCreating a simple color palette or color picker in javascript and html
Color palettes are one of the prime resource of a web 2.0 website. There are many color picker codes available online, but they all involve lot of coding and pasting stuff here and there. And some useless CSS and input boxes, which in result mess up the core code. Well here I have designed a simple
Read Full PostAdd append remove value in select html element using javascript
Hiya Guys, Its been long since i posted here on "DigiMantra". Been really busy in my office and events,conferences etc. As I love to write code/tutorials here so I am back :P This time I am gonna show you how can you swap elements from one select html element to another. Demo var box2;var bo
Read Full PostAdd javascript function using css class
In this tutorial i am gonna show you how a javascript function can be hooked to a HTML element with its predefined class or id attribute. We are going to use class attribute here because we may want to have multiple elements of the same kind where in we want the javascript functions to be hooked. We
Read Full PostAn alternate for Associative array in javascript
Yeah i know array is what you have been living with because you think you do not require object at some places. And talking about array, you gonna choose associative arrays for sure, right eh ? Well on the sad note you do not get associative arrays inside javascript. Its not that you do not get,
Read Full PostPrototype in javascript | An object oriented javascript
In this tutorial i am going to show you how to use prototype object in javascript to change the way you used to code. Prototype is an amazing way to add custom properties/methods to your existing legacy Objects or make your own. Well did that sound complicated ? Hmmm.. Lets go further and make sense
Read Full PostSimple Timer in javascript
This tutorial shows you a simple count down timer in javascript, which you can modify according to your need.. This is in javascript, hence it is not as powerful as it should be, like if a user refreshes its browser, the value is not stored anywhere, and the countdown timer start again. But for t
Read Full PostHide/show div,elements with javascript
In this tutorial i am going to explain how can we hide or unhide elements on a webpage using simple javascript function. Let me tell you this function is very basic and can be extended according to your requirement. There are certain readymade libraries/frameworks available like jquery,prototype. Th
Read Full PostChange a CSS class dynamically using Javascript
Hi everyone, Yet another tutorial of javascript explaining very basic functionlity of it. But this can be extended further to fo the javascript magic :) Well in this you will learn how to change the class of any element dynamically on an event. I am using the onclick event which is fired when
Read Full PostAdding a class to an element using javascript
There are times when you need to add/change a class for a particular element. This can be very easily achieve using the className method. Please refer to the following snippet of code to understand how it works. Explanation is given after the code. function addClass(obj) { obj.classNa
Read Full Post