This is a discussion on "Javascript syntax in html attributes" within the JavaScript Forum section. This forum, and the thread "Javascript syntax in html attributes are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Javascript syntax in html attributes
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Javascript syntax in html attributes
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.
Thanks, --Kenoli Last edited by karinne; Sep 10th, 2007 at 13:17. Reason: Please use [ code ]...[ /code ] tags when displaying code. |
|
|
|
#2
|
|||
|
|||
|
Re: Javascript syntax in html attributes
I put all my javascript, including event handlers, in the external JS file. It makes for easier code management.
If you weave your javascript into your HTML, then you can have a real headache when you decide to change those event handlers. |
|
#3
|
|||
|
|||
|
Re: Javascript syntax in html attributes
Yes, great. I think I've got it figured out. I think I was working from more recent incarnations of javascript and thrown a bit by "old style" coding.
Thanks, --Kenoli |
|
#4
|
|||
|
|||
|
Re: Javascript syntax in html attributes
Check out this article, which describes how to move event handlers out of HTML and into JS: http://www.digital-web.com/articles/...d_structure_2/
|
|
#5
|
|||
|
|||
|
Re: Javascript syntax in html attributes
Thanks for the link. It is a great article and I have read it. It was partially being aware of his admonitions on event handling that I got thrown off by the code I found.
I also have his book and find it amazing in how it goes deeper where useful for practical coding and puts the less useful stuff in perspective. So much better than books that seem more focused on a formal presentation of javascript over bringing the readers attention to those things that really impact practical use. Just because something is subtle doesn't mean it doesn't need attention if it has a real world impact. I wish someone would write a book on php like this. Didn't mean to launch into a review, but couldn't help myself. --Kenoli |
![]() |
| Tags |
| attribute, mouseout, mouseover |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Multi-Quote in Javascript/html help | Manz16 | JavaScript Forum | 0 | Apr 11th, 2008 20:11 |
| HTML/CSS/Javascript custom scrollbar | Voodoochilli | Web Page Design | 10 | Jun 25th, 2007 22:09 |
| Web Developer - CSS, JavaScript, HTML - Cambridge | Web JobBot | Job Opportunities | 0 | Oct 18th, 2006 14:03 |
| Using PHP, Javascript and HTML all in one | audioelite | PHP Forum | 7 | Oct 13th, 2006 23:31 |