Hi,
Just new to JavaScript and I'm trying the following:
I include my javascript file:
In my html code i have an image:HTML Code:<script type="text/javascript" src="javascript/script.js"></script>
The script file contains the following:HTML Code:<img id="nu" class="website" src="images/website_images/nu.png" />
Why isnt this working?Code:var nu_image = document.getElementById("nu"); function test() { window.alert('test!'); }; nu_image.onclick = test();
When i use this it works:
but i want the onclick etc in the javascript page, not between the html code...HTML Code:<img id="nu" class="website" src="images/website_images/nu.png" onclick="test();" />
anyone any suggestions?
Thanx!



Reply With Quote

Bookmarks