I am trying to understand some existing script and came across the following application of javascript in html attributes in an <a> tag. It was generated by php so it might not be the most orthodox javascript. onmouseover="window.status='View this entry'; show(event, 'eventinfo-224-5'); return true;" onmouseout="window.status=''; hide('eventinfo-224-5'); return true;" I assume what is going on here is the same as the following javascript (show and hide being pre-defined functions): window.status='View this entry'; show(event, 'eventinfo-224-5'); return true; and: onmouseout=window.status=''; hide('eventinfo-224-5'); return true; Any comments on this way of including javascript scripts? Can one include scripts in any attribute in this manner? Is there no need for <script> tags? Other comments? Thanks, --Kenoli
Technically you could include all your code like that, but more often than not you use the onclick etc tributes for the functions as event handlers. They'll contain onclick="javascript:function()" and function will have already been defined in an external script file or something. Check out the source of my site: http://www.coffeesh0p.com for some more examples.