Archive for April, 2011

Check object exists or not

April 12, 2011 Leave a comment

We can check through javascript whether html element exists or not.
create this function
function checkobject(obj) {
if (document.getElementById(obj)) {
return true;
}else {
return false;

Pass element’s id in this function, this function return ‘true’ if that element exists on web page other wise return false.



How to get which element clicked

April 11, 2011 Leave a comment

We can find out which element clicked on web document.
First we need to create a function i.e
function gotElement(){
var ele = arguments[0] || window.event, origEl = || ev.srcElement;
alert(ele.tagName);//Getting  tag name of element.

Now call this function like this…
document.onclick = gotElement();

Whenever user click on click on document then a alert will open that contains tag name.

How to check browser has javascript enabled or not

April 7, 2011 Leave a comment

The <noscript> tag is used to provide an alternate content for users that have disabled scripts in their browser or have a browser that doesn’t support client-side scripting.

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “”&gt;

<html xmlns=”; xml:lang=”en”>
<meta http-equiv=”refresh” content=”0;url=”/>

%d bloggers like this: