Javascript

Detect screen resolution using PHP

Detect screen resolution using PHP

The ability to detect your website visitor's screen resolution gives you more freedom on how you want to display your website's content to the end user. This will help you to remove unnecessary scrollbars, that appear when the user's screen resolution is low, by serving the right version of the webpage. By default there is no such function in PHP which detects display resolution. Still there is an easy work around and it is achieved by using JavaScript along with PHP. Javascript provides the user's screen resolution information and this can be accessed by using the screen.width and screen.height properties.

Read More

How to implement DRAG AND DROP feature using HTML5

HTML5

 There is no doubt that HTML5 is making life easy and fast for web developers. With its new attributes for elements, HTML5 is a boon of the decade. In this tutorial we will learn about one of the most useful feature of HTML5, that is drag and drop method and how to implement it.

Read More

How to convert canvas data into image

javascript

With the growing use of HTML5 in web development, its canvas element is something which cannot be ignored. In simple words, CANVAS element is used to draw graphics on a web page using javascript.

We often come across situations where we need to convert canvas data into images. In this tutorial we will learn how to convert canvas data into different image formats

Read More

Javascript Redirect

javascript

You may need to use Javascript Redirect in following situations

  • You have a new and updated content and you want to redirect your users there.
  • You want to introduce some time delay to grab user's attention and then redirect him/her to a specific webpage.
  • You have got yourself a new domain name. 

Well you can easily do so with javascript. If you want to perform a simple redirect i.e. upon landing on your webpage the user should be redirected to some other page use the code snippet given below -

Read More

Count number of words using JavaScript

javascript

To count the number of words present inside a textbox or in a string variable is very easy and simple task. The trick is to use split() function of the Javascript. spilt() function takes delimiter as argument.

So we will be assuming that number of words is equal to the number of spaces present in the text and we will count the number of spaces present in the text using the split() function. Check out the examples given below.

Read More