How come when I use the following code, clicking on "Click Here" doesn't trigger an alert? Why can't I call methods of things other than the window object? E.g. a method of the test1 function?
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function test1() {
test1.test2 = function() {
alert('Test');
}
}
</script>
</head>
<body>
<div onClick="test1.test2()">Click Here</div>
</body>
</html>