HTML 用JS做,表单中几个下拉表单 将选的值用一个提交按钮在同一界面一个对应的表格中显示出来,求高手指
2个回答
展开全部
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script language="javascript">
function checkSel() {
//获取select对象
var selectNode1 = document.getElementById("selectNode1");
var selectNode2 = document.getElementById("selectNode2");
var selectNode3 = document.getElementById("selectNode3");
//获取labl对象
var lb = document.getElementById("lb1");
//动态创建表格,也可以不动态创建,可再body中把表格写好,再这给它们设值。
var table = document.createElement("table");
table.border = "1"; //设置边框
//创建一行
var tr = table.insertRow();
//创建三列,并将三个select的值设置到这三列中。
var td0 = tr.insertCell();
td0.innerText = selectNode1.options[selectNode1.selectedIndex].value;
var td1 = tr.insertCell();
td1.innerText = selectNode2.options[selectNode2.selectedIndex].value;
var td2 = tr.insertCell();
td2.innerText = selectNode3.options[selectNode3.selectedIndex].value;
//将创建的table添加到labl中去。
lb.appendChild(table);
}
</script>
<BODY>
<div>
<select id="selectNode1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="selectNode2">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<select id="selectNode3">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<br />
<label id="lb1"></label>
<br />
<input id="btn1" type="button" value="button" onclick="checkSel()" />
</div>
</BODY>
</HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
</HEAD>
<script language="javascript">
function checkSel() {
//获取select对象
var selectNode1 = document.getElementById("selectNode1");
var selectNode2 = document.getElementById("selectNode2");
var selectNode3 = document.getElementById("selectNode3");
//获取labl对象
var lb = document.getElementById("lb1");
//动态创建表格,也可以不动态创建,可再body中把表格写好,再这给它们设值。
var table = document.createElement("table");
table.border = "1"; //设置边框
//创建一行
var tr = table.insertRow();
//创建三列,并将三个select的值设置到这三列中。
var td0 = tr.insertCell();
td0.innerText = selectNode1.options[selectNode1.selectedIndex].value;
var td1 = tr.insertCell();
td1.innerText = selectNode2.options[selectNode2.selectedIndex].value;
var td2 = tr.insertCell();
td2.innerText = selectNode3.options[selectNode3.selectedIndex].value;
//将创建的table添加到labl中去。
lb.appendChild(table);
}
</script>
<BODY>
<div>
<select id="selectNode1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<select id="selectNode2">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<select id="selectNode3">
<option value="A">A</option>
<option value="B">B</option>
<option value="C">C</option>
</select>
<br />
<label id="lb1"></label>
<br />
<input id="btn1" type="button" value="button" onclick="checkSel()" />
</div>
</BODY>
</HTML>
展开全部
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script language="javascript">
function checkSel() {
var sel = document.getElementById("sel1");
var lb = document.getElementById("lb1");
lb.innerHTML = sel.options[sel.selectedIndex].value;
}
</script>
</head>
<body>
<div>
<select id="sel1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<br />
<label id="lb1"></label>
<br />
<input id="btn1" type="button" value="button" onclick="checkSel()" />
</div>
</body>
</html>
<head runat="server">
<title></title>
<script language="javascript">
function checkSel() {
var sel = document.getElementById("sel1");
var lb = document.getElementById("lb1");
lb.innerHTML = sel.options[sel.selectedIndex].value;
}
</script>
</head>
<body>
<div>
<select id="sel1">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
<br />
<label id="lb1"></label>
<br />
<input id="btn1" type="button" value="button" onclick="checkSel()" />
</div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询