复制代码代码如下:
<% @ Page Language = "Java" Import = "Java.util. *" Pageencoding = "UTF-8"%>
<%
String path = request.getContextPath ();
String basepath = request.getscheme () + ": //"
+ request.getServerName () + ":" + request.getServerport ()
+ chemin + "/";
%>
<! Doctype html public "- // w3c // dtd html 4.01 transitional // en">
<html>
<adal>
<base href = "<% = baspath%>">
<Title> ma page de départ jsp 'CreateElement.jsp' </Title>
<méta http-equiv = "pragma" contenu = "non-cache">
<meta http-equiv = "cache-control" content = "no-cache">
<méta http-equiv = "expires" content = "0">
<meta http-equiv = "keywords" contenu = "keyword1, keyword2, keyword3">
<méta http-equiv = "Description" content = "Ceci est ma page">
<script type = "text / javascript"
src = "<% = request.getContextPath ()%> / jQuery / jQuery-1.7.min.js"> </ script>
<script type = "text / javascript">
$ (function () {
$ ("# mais"). Cliquez sur (fonction () {
var para = document.CreateElement ("p");
var node = document.CreateTextNode ("这是新段落。");
Para.ApendChild (nœud);
var element = document.getElementById ("div1");
element.ApendChild (para);
})
})
</cript>
</ head>
<body>
<div id = "div1">
<p id = "p1">
这是一个段落。
</p>
<p id = "p2">
这是另一个段落。
</p>
</div>
<input type = "bouton" id = "mais" value = "添加">
</docy>
</html>