<script type="text/javascript">
function gr8r( form ) {
document.write( '"' + form.s1.value + '"' );
if ( form.s1.value > form.s2.value )
document.write( ' is gr8r than ' );
else
document.write( ' is not gr8r than ' );
document.write( '"' + form.s2.value + '"' );
}
</script>
<form action="" method="post">
<input type="text" name="s1" value="" />
<input type="text" name="s2" value="" />
<br />
<input type="button" value="click" onclick="gr8r(this.form)" />
</form>
我期望的结果是在我单击按钮然后显示 html 表单后执行 javascript ......但之后没有显示 html 表单......
非常感谢任何帮助,谢谢!
我想要的输出是:
2 is gr8r than 1
<form action="" method="post">
<input type="text" name="s1" value="" />
<input type="text" name="s2" value="" />
<br />
<input type="button" value="click" onclick="gr8r(this.form)" />
</form>