复制代码代码如下:
<%@ 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> หน้าเริ่มต้นของ JSP 'createElement.jsp' ของฉัน </title>
<meta http-equiv = "pragma" content = "no-cache">
<meta http-equiv = "cache-control" content = "no-cache">
<meta http-equiv = "หมดอายุ" content = "0">
<meta http-equiv = "คำหลัก" content = "keyword1, keyword2, keyword3">
<meta http-equiv = "คำอธิบาย" content = "นี่คือหน้าของฉัน">
<script type = "text/javascript"
src = "<%= request.getContextPath ()%>/jQuery/jQuery-1.7.min.js"> </script>
<script type = "text/javascript">
$ (function () {
$ ("#but") คลิก (function () {
var para = document.createElement ("P");
var node = document.createTextNode ("这是新段落。");
Para.AppendChild (โหนด);
var element = document.getElementById ("div1");
Element.AppendChild (Para);
-
-
</script>
</head>
<body>
<div id = "div1">
<p id = "p1">
这是一个段落。
</p>
<p id = "p2">
这是另一个段落。
</p>
</div>
<อินพุต type = "ปุ่ม" id = "แต่" value = "添加">
</body>
</html>