Prototype框架学习$F()函数

<%@ page language="java" import="java.util.*" contentType="text/html; charset=gbk"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    <!-- 引入Prototype.js-->
    <script type="text/javascript" src="prototype-1.4.0.js">
    </script>
    <title>prototype学习</title>
    <script type="text/javascript"></script>
    <!-- $F()函数其实就是获取表单中输入的控件的值. -->
<script type="text/javascript">
function show(){
$("show").innerHTML = $F("text1")+"<br>"+$F("text2")+"<br>"+$F("text3");

}


</script>

  </head>
 
  <body>
 
  <form action="#" name="form1" id="form1">
  <input type="text" id="text1"><br>
  </form>
  <form action="#" name="form2" id="form2">
  <input type="text" id="text2"><br>
  <textarea rows="3" cols="40" id="text3"></textarea><BR>
  </form>
  <div id="show"></div>
  <input type="button" onclick="show()" value="显示文本框中的值">
</body>
</html>

你可能感兴趣的:(prototype)