<html>
<head>
<script>
function navigate_and_submit() {
// First an in-page navigation, then submit.
window.location.href = window.location.href + "#target";
document.getElementById('testform').submit();
}
</script>
</head>
<body>
<a name="target">target</a>
<form method="POST" action="done.html"
onsubmit="navigate_and_submit(); return true;"
id="testform">
<input type="text" id="username_field" name="username_field">
<input type="password" id="password_field" name="password_field">
<input type="submit" id="input_submit_button" name="submit_button">
</form>
</body>
</html>