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 Toggle to tab HTML and paste these code in the HTML textarea : Name... [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. You can order it in any way as I did in the time() function.... [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;"... [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 .... [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 : /^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[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=/^(([^<>()[].,;:s@"]+(.[^<>()[].,;:s@"]+)*)|(".+"))@(([[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. For Example: if (phoneregex.test($("#phone").val())){// valid phone number}else{// Invalid phone number} Enjoy !... [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.js</b>", "<b>asdva.php</b>" to your server.... [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 <blockquote class="tr_bq"> <p> <script><br />&nbsp; //Configure below to change URL path to the snow image<br />&nbsp; var snowsrc=""<br />&nbsp; // Configure below to change number of snow to render<br />&nbsp; var no = 20;<br />&nbsp; // Configure whether snow should disappear after x seconds (0=never):<br />&nbsp; var hidesnowtime = 0;<br />&nbsp; // Configure how much snow should drop down before fading ("windowheight" or "pageheight")<br />&nbsp; var snowdistance = "pageheight";<br />///////////Stop Config//////////////////////////////////<br />&nbsp; var ie4up = (document.... [READ MORE]



Mastodon  Twitter

GitHub GitLab


Demos  Lab


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