Posts marked with "JavaScript" in categories

How to show Disqus comment count in Blogger

Many of sites have switched to Disqus comment system. It’s fast, easy and simple to use. Many wanted to show the comment count on their homepages. For showing the comment count on your Blogger Blog you can just do a simple trick. Go to **Blogger -> Template** -> Edit HTML. Place this Javascript code above . <script type="text/javascript"> /* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */ var disqus_shortname = '<span style="... [READ MORE]

Creating a Contact Me page for Blogger Blog

Blogger has added a new widget in their widget page. This widget is a Contact Me widget which allows blog visitors to contact you. This can be added in your blog sidebar or footer. In this tutorial I will tell you to how to add this to a blog page. Create a blank page from Blogger -> Pages -> New Page -> Blank Page... [READ MORE]

How to get Current Time and date in Javascript

This tutorial will help you to get current date and time at which the function is executed. Here is the function: function ctime(){ var currentdate = new Date(); var time=currentdate.getFullYear()+"-"+(currentdate.getMonth()+1)+"-"+currentdate.getDate()+" "+currentdate.getHours()+":"+currentdate.getMinutes()+":"+currentdate.getSeconds(); return time; } Just print out ctime() function to get the date and time in the format YEAR/MONTH/DAY HOUR:MINUTE:SECOND  Explanation : new Date() function prints out the current date and time in a disorderly way.... [READ MORE]

How to check if the mouse is over an element in jQuery?

Here is a simple plugin to check if the mouse is over an element in JQuery. Open your jQuery source file and search for window.jQuery = window.$ = jQuery;  Paste the code shown below after the code you have just found. <span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> $</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">mlp </span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">{</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">x</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="lit" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">0</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">,</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">y</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">:</span><span class="lit" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">0</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">};</span><span class="kwd" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">function</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> documentHandler</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">(){</span><span class="kwd" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">var</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> $current </span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="kwd" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">this</span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">===</span><span class="pln" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;"> document </span><span class="pun" style="border: 0px; margin: 0px; padding: 0px; vertical-align: baseline;">?... [READ MORE]

jQuery .live function removed in V 1.9. What is the best replacement for .live function ?

As of jQuery version 1.9, the .live function has been removed which means it is no longer available to use. Instead of this function you can use .on function which also has the same function as .live.  Both of them attach an event handler for all elements which match the current selector, now and in the future. Since .live has been removed you can use .on function. Here’s how we should do it. Replace .live function with .... [READ MORE]

Using Regex to validate E-mail and Phone Number

Here is the RegEx expression to validate Phone number and E-mail. RegEx expression for validating E-mail : /^(([^<>()[].,;:[email protected]"]+(.[^<>()[].,;:[email protected]"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/ and the RegEx expression for validating Phone number : /^(?([0-9]{3}))?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/ Here is an example of usage of these RegEx expressions in JavaScript. var emailregex=/^(([^<>()[].,;:[email protected]"]+(.[^<>()[].,;:[email protected]"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;var phoneregex=/^(?([0-9]{3}))?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/;if (emailregex.test(string)){// valid email}else{// Invalid email}if (phoneregex.test(string)){// valid phone number}else{// Invalid phone number} You can replace string with whatever you want.... [READ MORE]

Jquery ExtAjax Plugin V 1.2: Submit forms to external files with preview using Jquery

If you don’t know what this plugin will do then visit the page of the previous version here. The last version of Jquery ExtAjax plugin didn’t have preview feature. But in this version it have a preview feature. The latest version is V 1.2 What’s New in this version Faster Preview feature.  What should I do after downloading. <div> <span style="color: #333333;"><span style="line-height: 16px;">After downloading upload "<b>extajax.... [READ MORE]

Storing JSON object in HTML5 Local Storage : Stringify

This tutorial will help you to store JSON Object in LocalStorage. This method uses a function called stringify. Suppose we have a JSON object like this : var data = {name:’subin’,class:’8A’}; If we want to store this JSON object in Local Storage then use the function below: localStorage[‘info‘]=JSON.stringify(data); That’s it. JSON Object is now stored in your Local Storage.... [READ MORE]

Make Snowfall on your site/blog using Javascript

It’s Christmas. It’s time for snowing. Want to have a snowfall on your site just like in my blog. Here’s the Java script for snowing. Note – This code is for websites. Code for blogger is below this code   //Configure below to change URL path to the snow image   var snowsrc="http://subins.hp.af.cm/files/images/snow.gif"   // Configure below to change number of snow to render   var no = 20;... [READ MORE]

Subscribe

By subscribing, you agree with Revue’s Terms of Service and Privacy Policy.

Donate

If you found something helpful, please consider a donation to support this site and projects :)

Donate

Subdomains

DemosLab

Past

This blog was once on WordPress. Now a static site. See source code on

GitLab