论坛首页 入门技术论坛

构件自己的JS函数库

浏览 1490 次
该帖已经被评为新手帖
作者 正文
   发表时间:2009-02-27  
构件自己的函数库首先将自己所见的JS函数的包含进JSP页面中,具体如下:
<script language="JavaScript" type="text/javascript" src="example.js"></script>

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<%
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%>">
    
    <title>构件自己的Ajax函数库</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<script language="JavaScript" type="text/javascript" src="example.js"></script>
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    This is my JSP page. <br>
    <select id="product" size="1" onchange="order()">
       <option value="1" selected>苹果</option>
       <option value="2">西瓜</option>
       <option value="3">荔子</option>
    </select>
    数量:<input id="num" size="10" type="text"><br>
  单价:<input id="price" size="10" type="text">
  总价:<input id="result" size="10" type="text">
  </body>
</html>
论坛首页 入门技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics