Tag: code

Javascript Code to Scrolling Page Title

Here I am going to share the Javascript code for scrolling the page title of any web page. You can change the page title by simply set document title property using javascript Scrolling Page Title Code You can change the scroll speed by changing the value of variable “speed”. Above it is 150, which means

jQuery Show and Hide Div Element

Here’s a simple tutorial on how to show and hide the div content based on the click event using jQuery. Example1: Click on the below “item” link to display the content and click again to hide. Item Content Example2: This example shows multiple links and content. Click on “item1” to show and hide the content

Change Font Size with JavaScript

Here is the javascript code to increase or decrease the font size on the fly, you can give control to the user to change the text size for better readability. function resizeFont(multiply) { var sz = document.body.style.fontSize; if (sz =='') sz = 14; //default font size var size = parseFloat(sz) + (multiply * 0.2) +

Create, Read and Delete Cookies with JavaScript

In this tutorial, I am going to give a JavaScript code samples to create, read and delete the cookies. Setting a Cookie function SetCookie(name,value,days) { var now= new Date(); var expDate = new Date(); if (days==null || days==0) days=1; //create date after no of "days" from now expDate.setTime(now.getTime() + 3600000*24*days); //create cookie with name, value

How To Get Url Parameters Using Javascript

Here, I am going to share Javascript code to get the URL querystring parameter values. Let me take a sample URL and try to get the parameter values in it. http://www.techtricky.com?id=77&name=sree Here is the function to create the Javascript object with parameter names and values. function getUrlParams() { var params = {}; window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(str,key,value) {

jQuery Template Plugin

jQuery template plugin allows you to render template items into HTML DOM, template items are HTML markup or text. Basically, we can define HTML markup with template variables and replace these variables inside the DOM when you get the data from an Ajax call or local static data. Here is the simple example to display

Highlight text with jQuery

Here I am going to show how to highlight particular word within a block of text.You can use this feature to:– highlight the search terms on the page.– highlight particular keywords dynamically on the page.– highlight negative numeric values on block of page. Below is the working example, enter the text in textbox and click
Close Bitnami banner