0
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Facility Screen</title>
<script>
function loadxml()
{
//pid=document.getElementById("pid");
input=document.getElementById("customer_id");
alert(input.value);
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
//alert("hi");
// alert(xmlhttp.responseText);
var res=xmlhttp.responseText.split("+");
s=document.getElementById("select");
for(var j = 0; j < res.length-1; j++)
{
// alert("hi");
var t = document.createElement("option");
t.value =res[j];
t.innerHTML =res[j] ;
s.appendChild(t);
}
}
}
xmlhttp.open("GET","http://localhost:8080/EMS/Facility_controller?cid="+input.value,true);
xmlhttp.send();
}
</script>
<script>
function loadxml1()
{
alert("hi");
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
res=xmlhttp.responseText.split("+");
s=document.getElementById("select1");
for(var j = 0; j < res.length-1; j++)
{
var t = document.createElement("option");
t.value =res[j];
t.innerHTML =res[j] ;
s.appendChild(t);
}
}
}
xmlhttp.open("GET","http://localhost:8080/EMS/Facilty_type",true);
xmlhttp.send();
}
</script>
<script>
function loadxml2()
{
alert("xml2");
var input=document.getElementById("select1");
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
res=xmlhttp.responseText.split("+");
s=document.getElementById("select2");
for(var j = 0; j < res.length-1; j++)
{
var t = document.createElement("option");
t.value =res[j];
t.innerHTML =res[j] ;
s.appendChild(t);
}
}
}
xmlhttp.open("GET","http://localhost:8080/EMS/vendor_id?facility="+input.value,true);
xmlhttp.send();
}
</script>
<script >
function loadxml3()
{
facility=document.getElementById("select1");
alert(facility.value);
vendor_id=document.getElementById("select2");
alert(vendor_id.value);
var xmlhttp;
if(window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
xmlhttp.onreadystatechange=function()
{
if(xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").value=xmlhttp.responseText;
}
}
xmlhttp.open("GET","http://localhost:8080/EMS/Cost_controller?facility="+facility.value+"&vendor_id="+vendor_id.value,true);
xmlhttp.send();
}
</script>
</head>
<body>
<form method="get" >
<table>
<tr>
<td>Customer id</td>
<td><input type="text" id="customer_id" name="customer_id" onblur="loadxml()"></td>
</tr>
</table>
</form>
<table>
<tr><td>VENUE ID</td><td><select id="select" onchange="loadxml1()"></select></td></tr>
<tr><td>FACILITY</td><td><select id="select1" onchange="loadxml2()" ></select></td></tr>
<tr><td>VEDNOR ID</td><td><select id="select2" onchange="loadxml3()"></select></td></tr>
<tr><td>COST</td><td><input type="text" id="myDiv"></td></tr>
<tr><td>QUANTITY</td><td><input type="text" id="quantity" name="quantity"></td></tr>
</table>
</body>
</html>
这是我的事件管理系统项目的前端赖以我做facility_module之前删除字段上我能够动态填充组合框从数据库使用Ajax,但我必须再次添加相同的字段设施vendor_id成本和数量当我按下添加按钮并按删除按钮时按下提交按钮删除字段所有这些值将被添加到数据库中。如何在jsp中使用jquery或Ajax再次添加相同的字段?添加和删除按钮添加和插入到数据库
如何添加选择元素BY USING ID u能PLEASE演示如何使用内部HTML重复表行 – user3255995