欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

js動(dòng)態(tài)創(chuàng)建標(biāo)簽示例代碼

 更新時(shí)間:2014年06月09日 10:20:08   作者:  
這篇文章主要以示例的方式為大家介紹下js如何動(dòng)態(tài)創(chuàng)建標(biāo)簽,需要的朋友可以參考下
復(fù)制代碼 代碼如下:

<%@ 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' starting page</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 type="text/javascript"
src="<%=request.getContextPath()%>/jquery/jquery-1.7.min.js"></script>
<script type="text/javascript">
$(function() {
$("#but").click(function() {
var para = document.createElement("p");
var node = document.createTextNode("這是新段落。");
para.appendChild(node);

var element = document.getElementById("div1");
element.appendChild(para);

})
})
</script>
</head>
<body>
<div id="div1">
<p id="p1">
這是一個(gè)段落。
</p>
<p id="p2">
這是另一個(gè)段落。
</p>
</div>
<input type="button" id="but" value="添加">
</body>
</html>

相關(guān)文章

最新評(píng)論