<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>较大值</title>
<script language="javascript">
function textIf(){
var v1=document. fm1.tx1.value;
v2=document.fm1.tx2.value;
if(v1>v2){document.fm1.tx3.value=v1;}
else{document.fm1.tx3.value=v2;}
}
</script>
</head>
<body>
<h1>求较大值</h1>
<form name="fm1" action="*.jsp">
<input type="text" name="tx1">
<input type="text" name="tx2">
<input type="text" name="tx3">
<input type="button" value="较大值" onClick="textIf()">
</form>
</body>
</html>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>较大值</title>
<script language="javascript">
function textIf(){
var v1=document. fm1.tx1.value;
v2=document.fm1.tx2.value;
if(v1>v2){document.fm1.tx3.value=v1;}
else{document.fm1.tx3.value=v2;}
}
</script>
</head>
<body>
<h1>求较大值</h1>
<form name="fm1" action="*.jsp">
<input type="text" name="tx1">
<input type="text" name="tx2">
<input type="text" name="tx3">
<input type="button" value="较大值" onClick="textIf()">
</form>
</body>
</html>
v2=parseInt(document.fm1.tx2.value);
<div>
<input type="text" name="tx1" />
<input type="text" name="tx2" />
<input type="text" name="tx3" />
<input type="button" value="较大值" onclick="textIf()" />
</div>
</form> <script language="javascript" type="text/javascript">
function textIf(){
var v1=parseInt(document.fm1.tx1.value);
v2=parseInt(document.fm1.tx2.value);
if(v1>v2){document.fm1.tx3.value=v1;}
else{document.fm1.tx3.value=v2;}
}
</script>
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>较大值</title>
<script language="javascript">
function textIf(){
document.fm1.tx3.value=((document.fm1.tx1.value - document.fm1.tx2.value) > 0 ? document.fm1.tx1.value : document.fm1.tx2.value);
}
</script>
</head> <body>
<h1>求较大值</h1>
<form name="fm1" action="*.jsp">
<input type="text" name="tx1">
<input type="text" name="tx2">
<input type="text" name="tx3">
<input type="button" value="较大值" onClick="textIf()">
</form>
</body>
</html>