30
While the design of a website is already separated from the content by using CSS (Cascading Style Sheets), the scripting features of a website can also be pulled out off the HTML file.
The technique to do this is called unobtrusive JavaScript and InfoQ.com has a nice writeup about it. Basically, instead of directly writing code into the event handlers of a tag, say onClick of an img you attach the code later in a JavaScript that is included at the bottom of a page. This means that you bascially traverse the DOM-Tree of the website and set the onClick property there.
While this is definitely a nice thing, there are caveats:
InfoQ.Com reader Gabriel Ka. points out that it will make the website harder to debug. Another reader, Luis Fernando Planella Gonzalez, points out that such a JavaScript at the bottom of a Website will make the website non-functional even some seconds after it has finished loading (at least in browsers with a slow JavaScript engine)
If you are interested in knowing more, read it on InfoQ or at a tutorial like the one of Michael Minella.
Are you interested in reading more from CodingClues?
Then subscribe to new postings
via RSS or
via
E-Mail.
Add New Comment
Viewing 2 Comments
Thanks. Your comment is awaiting approval by a moderator.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Do you already have an account? Log in and claim this comment.
Add New Comment
Trackbacks
(Trackback URL)