I have found a proper solution and wanted it to share with u guys.
Instead of using <input type="submit...>
, use <button type="submit"...>
.
This will do exactly the same in the other browsers (IE6-7, FF3) AND works in IE8. :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<style type="text/css">
#test {
display: none;
}
</style>
<script type="text/javascript">
onload = function() {
document.getElementById('test').style.display = 'block';
};
</script>
</head>
<body>
<form id="test" method="get" action="javascript:alert('woei!')">
<input type="text" name="user" value="" />
<input type="password" name="pw" value="" />
<button type="submit" value="submit" id="submit"></button>
</form>
</body>
</html>
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…