JavaScript outer click
What does it take to know where click was?
You can find some source code under the cut.
<html>
<head>
<style>
body {
	background	: #00ff00;
}

#btn {
	border		: 1px solid #000000; 
	margin-top	: 100px;
	background	: #cccccc;
	text-align	: center;
	cursor		: pointer;
}
</style>
</head>
<body>
<div id="btn">CLICK ME</div>
</body>
<script>
document.onclick = function(e) {
	e = e || window.event;
	if (!e.target) {
		e.target = e.srcElement; 			
	}

	alert("btn" == e.target.id ? "inner" : "outer");
}
</script>
</html>
June 3rd, 2011
Back to main
Moi krug - Yernat Assanov
Advertisement
Documentolog
(C) 2010, kseeker
Email: kseeker@yandex.kz
Используются технологии uCoz