could someone please tell me why this simple code is not working?

i tried all variation i could remember, i click and click, tried in firefox IE, netscape, and nothing:
<html>
<head>
<title>behavior</title>
<script language="javascript" type="text/javascript">
var parag = document.getElementsByTagName("p");
for(var i=0; i<parag.length; i++) {
parag[i].onclick = function() {
alert("click!");
}
}
</script>
</head>
<body>
<p>one paragraph</p>
<p>other paragraph</p>
</body>
</html>
any kind of help wuld ge appreciated.