<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%> |
003 | String path = request.getContextPath(); |
004 | String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; |
006 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> |
009 | < base href="<%=basePath%>"> |
010 | < link rel = "stylesheet" href = "css/bootstraps.css" type = "text/css" media = "all" > |
011 | < link rel = "stylesheet" href = "css/mcontainer.css" type = "text/css" media = "all" > |
015 | < meta http-equiv = "pragma" content = "no-cache" > |
016 | < meta http-equiv = "cache-control" content = "no-cache" > |
017 | < meta http-equiv = "expires" content = "0" > |
018 | < meta http-equiv = "keywords" content = "keyword1,keyword2,keyword3" > |
019 | < meta http-equiv = "description" content = "This is my page" > |
021 | <link rel="stylesheet" type="text/css" href="styles.css"> |
024 | < script language = "javascript" > |
025 | function addSelect(tbodyID) |
027 | var bodyObj=document.getElementById(tbodyID); |
030 | alert("Body of Table not Exist!"); |
033 | var rowCount = bodyObj.rows.length; |
034 | var cellCount = bodyObj.rows[0].cells.length; |
035 | var newRow = bodyObj.insertRow(rowCount++); |
036 | for(var i=0;i< cellCount ;i++) |
038 | var cellHTML = bodyObj.rows[0].cells[i].innerHTML; |
040 | if(cellHTML.indexOf("none")>=0) |
042 | cellHTML = cellHTML.replace("none",""); |
044 | newRow.insertCell(i).innerHTML=cellHTML; |
046 | bodyObj.rows[rowCount-1].cells[0].innerHTML = "选项"+rowCount+":"; |
047 | bodyObj.rows[rowCount-1].cells[1].innerHTML = |
048 | bodyObj.rows[rowCount-1].cells[1].innerHTML.replace("value1","selectNames"); |
051 | function removeSelect(inputobj) |
053 | var bodyObj=document.getElementById("myTable"); |
054 | var rowCount = bodyObj.rows.length; |
055 | if(rowCount == 2)return; |
056 | if(inputobj==null) return; |
057 | var parentTD = inputobj.parentNode; |
058 | var parentTR = parentTD.parentNode; |
059 | var parentTBODY = parentTR.parentNode; |
060 | parentTBODY.removeChild(parentTR); |
066 | < form action = "" method = "post" > |
067 | < table width = "50%" border = "1" > |
070 | < td >< input type = "radio" name ="pattern" value = "Single" /></ td > |
075 | < td >< input type = "radio" name ="pattern" value = "Manay" /></ td > |
076 | < td >< label style = "color:red;" >${patternError}</ label ></ td > |
080 | < td >< input type = "text" required = "true" name ="themeName" /></ td > |
081 | < td >< label style = "color:red;" >${theme_SameName}</ label ></ td > |
087 | < input type = "text" required = "true" id = "values1" name = "selectNames" /> |
090 | < input type = button value = "删除选项" onclick = "removeSelect(this)" /> |
096 | < input type = "text" required = "true" id = "values1" name = "selectNames" /> |
099 | < input type = button value = "删除选项" onclick = "removeSelect(this)" /> |
104 | < td >< input type = button value = "增加选项" onclick = "addSelect('myTable')" /></ td > |
109 | < input type = "submit" value = "提交" > |
截图效果如下:
![151346_IzCJ_1401284.jpg](http://static.oschina.net/uploads/space/2014/0529/151346_IzCJ_1401284.jpg)
![151347_wy8e_1401284.jpg](https://i-blog.csdnimg.cn/blog_migrate/2867674f200fda5489112a586d7fb53b.jpeg)
![151347_zMFd_1401284.jpg](http://static.oschina.net/uploads/space/2014/0529/151347_zMFd_1401284.jpg)
![151348_gU2h_1401284.jpg](https://i-blog.csdnimg.cn/blog_migrate/7a76bfe6b2827e5a570663d37d14c4a1.jpeg)
转载于:https://my.oschina.net/u/1461277/blog/271451