复制代码代码如下:
<٪@ 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> my jsp 'createElement.jsp' صفحة البدء </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 = "الكلمات الرئيسية" content = "Keyword1 ، Keyword2 ، Keyword3">
<meta http-equiv = "description" content = "This is is my past">
<script type = "text/javaScript"
src = "<٪ = request.getContextPath () ٪>/jQuery/jQuery -1.7.min.js"> </script>
<script type = "text/javaScript">
$ (function () {
$ ("#ولكن"). انقر فوق (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 type = "button" id = "لكن" value = "添加">
</body>
</html>