Optimizing Apache/PHP/MySQL For Low Memory Use |
|
April 30, 2008 |
A few important reminders about good coding practices when JavaScript is required for link or forms. Using JavaScript incorrectly can prevent users from right-clicking (or middle-clicking) links to open pages in new windows or tabs if they want, and increases the risk that a critical hyperlink may not function. It may also not work as well down the road if a user someday wants to view the page on their mobile phone, etc.
JavaScript should basically never appear in an href. That is, you should basically never see some JS code here>
The href should almost always include the server-side URL to open, not # or JS code
If JavaScript is required, it should appear as an OnClick event, not in the href. Example:
View Webcast
If you’re interested, more examples can be seen at
In forms, don’t override the standard form Submit button action with JS. Instead, use the onsubmit event handler of the

April 30, 2008
Leave a Reply