可以,不过要注意js放置的位置<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> New Document </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
</head><body>
<form method=post action="" id="form1">
<input type="text" name="cab" value="abcd">
<input type="button" onclick="alert(document.body.innerHTML);">
</form>
</body>
</html>
<SCRIPT language="JavaScript">
var cab=document.forms("form1").cab.value;
document.write("<td width=63 align=center><font size=2><input type=text name=cabid size=6 readonly value="+cab+"></font></td>");
</SCRIPT>