Self-Contained Test Page
As mentioned in the FAQ, when trying to figure out the source of a problem, it's frequently useful to create a small, self-contained test page for replicating the problem in isolation. Why? Two reasons: Firstly, about 90% of the time, if you sit down and create a pared-down test case highlighting the problem, you'll figure out what's wrong yourself. Really. Instant help! Secondly, even if you don't find the answer yourself, you end up with a nice contained example other people can look at and help with.
Here's a template you can start with. Note the "TODO" markers.
<!DOCTYPE HTML>
<html>
<head>
<!-- TODO: Obviously, change this if you're using a different encoding -->
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<title>Test Page</title>
<script type='text/javascript' src='prototype.js'></script>
<script type='text/javascript'>
document.observe('dom:loaded', function() {
// TODO: Delete this and the button below if you don't need them
// for what you're trying to replicate
$('btnGo').observe('click', btnGo_click);
});
function btnGo_click() {
// TODO: The code for the action goes here
}
</script>
</head>
<body><div>
<input type='button' id='btnGo' value='Go' >
</div></body>
</html>
page revision: 4, last edited: 06 Dec 2009 12:04