I wrote a little javascript that was supposed to change the size of all images on my web page when a user clicks on it. But I resive an error when I try to run it.
<script type="text/javascript">
function changeSize(img){
var bigsize = "800";
var smallsize = "500";
if(img.height == bigsize) img.height = smallsize;
else img.height = bigsize;
}
var element = document.getElementsByTagName("img");
element.addEventListener('click',changeSize(this),false );
</script>
What am I doing wrong?