<p style="font-weight: bold">This is an introductory paragraph.</p>
<p class="introduction">This is an introductory paragraph.</p>
p.introduction { font-weight: bold; }
<a href="javascript:window.open('help.html')">my help page</a>
<a href="#" onclick="window.open('help.html'); return false">
my help page</a>
<a href="help.html"
onclick="window.open(this.getAttribute("href")); return false;">
my help page</a>
<a href="help.html" class="help">my help page</a>
function doPopups() {
var links = document.getElementsByTagName("a");
for (var i=0; i < links.length; i++) {
if (links[i].className.match("help")) {
links[i].onclick = function() {
window.open(this.getAttribute("href"));
return false;
};
}
}
}
<script type="text/javascript" src="file.js"></script>
doPopups();
window.onload = doPopups;
addLoadEvent
from Simon Willison: addLoadEvent(doPopups);
Treating Ajax as an "all or nothing" technology.
Treating Ajax as an enhancement.
XMLHttpRequest
instead of the server.Back-end architecture should be modular.
Web pages are created by joining modules together (e.g. navigation, log-in form, shopping cart, etc.)
Clicking on a link returns the same page but with one portion changed (different data or different view of data).
Example: Contact details (JS) (index.php) (people.php)
A page that includes a form: when the form is submitted, the same page is returned with just part of the page updated.
Example: Contact form (JS) (index.php) (formlogic.php)