Hi all,
I've been trying to add onclick event to all elements in the webpage. But somehow it doesn't work. Any help would be greatly appreciated.
Here's my code:
I've been trying to add onclick event to all elements in the webpage. But somehow it doesn't work. Any help would be greatly appreciated.
Here's my code:
Code:
function getIt()
{alert("Hello");}
var list = document.getElementsByTagName('*');
len = list.length;
for(i = 0;i < len;i++)
{
obj=list[i].tagName;
obj.onclick=getIt;
}
Comment