<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>两文本框同步显示输入文本</title>
<script type="text/javascript">
</script>
</head>
<body>
<form name="first"><!--第一个表单-->
文本框1:<!--用表单名引用表单及元素-->
<input type="text" οnkeyup="document.second.elements[0].value=this.value;" value="在这里输入内容" />
</form>
<form name="second"><!--第二个表单-->
文本框2:<!--用第二种方式引用表单及元素-->
<input type="text" οnkeyup="document.forms[0].elements[0].value=this.value;" value="在这里输入内容" />
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>两文本框同步显示输入文本</title>
<script type="text/javascript">
</script>
</head>
<body>
<form name="first"><!--第一个表单-->
文本框1:<!--用表单名引用表单及元素-->
<input type="text" οnkeyup="document.second.elements[0].value=this.value;" value="在这里输入内容" />
</form>
<form name="second"><!--第二个表单-->
文本框2:<!--用第二种方式引用表单及元素-->
<input type="text" οnkeyup="document.forms[0].elements[0].value=this.value;" value="在这里输入内容" />
</form>
</body>
</html>