Rule Definition
Separate behavior from presentation makes the code easier to read and debug, it lets designers and developer work on different files. It allows also to load the JavaScript from the browser one time only (and not each time the file is loaded) if included in the HTML file with the HTML link tag.
Remediation
Move JavaScript function from HTML file to a '.js' file
Violation Code Sample
<!DOCTYPE html>
<html>
<head>
<script>
function myFunction() {
document.getElementById("demo").innerHTML = "Paragraph changed.";
}
</script>
</head>
<body>
<h1>A Web Page</h1>
<p id="demo">A Paragraph</p>
<button type="button" onclick="myFunction()">Try it</button>
</body>
</html>
Reference
Best Practices: Implementing JavaScript for rich internet applications
http://thinkingandmaking.com/entries/63
Related Technologies
Technical Criterion
Efficiency - Memory, Network and Disk Space Management
About CAST Appmarq
CAST Appmarq is by far the biggest repository of data about real IT systems. It's built on thousands of analyzed applications, made of 35 different technologies, by over 300 business organizations across major verticals. It provides IT Leaders with factual key analytics to let them know if their applications are on track.