structure.html
<html>
<head>
<title>Instant Search</title>
<link rel="stylesheet" type="text/css" href="presentation.css" />
</head>
<body>
<input id="q">
<button id="b">Go!</button>
<script type="text/javascript" src="behavior.js"></script>
</body>
</html>
presentation.css
body { background-color:yellow; }
behavior.js
var SEARCH = function() {
var $ = {};
return {
init : function() {
$.q = document.getElementById('q');
$.b = document.getElementById('b');
$.b.onmouseup = function() { SEARCH.doStuff(); };
},
doStuff : function() {
alert($.q.value);
}
};
}();
window.onload = function() {
SEARCH.init();
};