大家好,我是一个新手,正在学习JS,想做一个网站,用Dreamweaver设计了一个界面,但是有的东西还是不太会,网上也找不到相关信息,当我点击添加按钮的时候,如何把4个下拉列表里面的内容合并在一起输出到textfield1内,如果再点击添加按钮的时候,把4个下拉列表里面的内容合并在一起输出到textfield2内,还有就是怎么样才能把复选框后的文字提交到另一个网页的文本域里面,请各位高手指点一下,谢谢。dw代码如下:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>project</title>
<style type="text/css">
<!--
body {
background-color: #00CCFF;
}
.STYLE2 {font-size: 16px; font-weight: bold; }
#Layer1 {
position:absolute;
width:712px;
height:388px;
z-index:1;
left: 104px;
top: 47px;
}
.STYLE3 {font-size: 16px}
-->
</style>
</head>
<body>
<title>project</title>
<table width="40" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../logo.gif" width="50" height="50" /></td>
</tr>
</table>
<br />
<table width="50" height="90" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">周报</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">总表</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2">退出</div></td>
</tr>
</table>
<div id="Layer1">
<form id="form1" name="form1" method="post" action="">
<table width="600" height="66" border="1" cellpadding="0" cellspacing="0" id="1">
<tr>
<td width="123" height="34"><div align="center" class="STYLE2">省份</div></td>
<td width="123"><div align="center" class="STYLE2">运营商</div></td>
<td width="123"><div align="center" class="STYLE2">项目</div></td>
<td width="120"><div align="center" class="STYLE2">项目号</div></td>
<td width="99" bgcolor="#00CCFF"> </td>
</tr>
<tr>
<td height="30"><select name="select1" id="select1" style="width:120px;height:25px" >
<option value="blank" selected="selected"></option>
<option value="HeNan">HeNan</option>
<option value="HeBei">HeBei</option>
<option value="ShanDong">ShanDong</option>
<option value="ZheJiang">ZheJiang</option>
</select>
</td>
<td><select name="select2" id="select2" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="CMCC">CMCC</option>
<option value="CUTC">CUTC</option>
<option value="CTC">CTC</option>
</select>
</td>
<td><select name="select3" id="select3" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="HN CUTC P8.3">HeNan CUTC P8.3</option>
<option value="HN CUTC P9.1">HeNan CUTC P9.1</option>
<option value="HeBei CMCC P12.1">HeBei CMCC P12.1</option>
</select>
</td>
<td><label for="select"></label>
<select name="select4" id="select4" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="1">A020080</option>
<option value="2">B030010</option>
</select>
<label for="select"></label>
<label></label></td>
<td bgcolor="#00CCFF"><div align="center">
<input name="Submit1" type="submit" id="Submit1" value="添加" style="width:55px; height:28px" />
</div></td>
</tr>
</table>
<p> </p>
<table width="589" height="40" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" id="2">
<tr>
<td width="490" bgcolor="#FFFFFF"><input name="textfield1" type="text" id="textfield1" style="height:25px" size="70" /></td>
<td width="99"><div align="center">
<input name="Submi22" type="submit" id="Submi22" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
<tr>
<td bordercolor="#00CCFF" bgcolor="#FFFFFF"><input name="textfield2" type="text" id="textfield2" style="height:25px" size="70" /></td>
<td><div align="center">
<input name="Submit32" type="submit" id="Submit32" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
</table>
<p> </p>
<table width="222" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="109"><input name="checkbox1" type="checkbox" id="checkbox1" value="checkbox" />
<span class="STYLE3">年假</span></td>
<td width="113">
<input name="checkbox5" type="checkbox" id="checkbox5" value="checkbox" />
<span class="STYLE3">丧假</span></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="checkbox" />
<span class="STYLE3">事假</span></td>
<td>
<input name="checkbox6" type="checkbox" id="checkbox6" value="checkbox" />
<span class="STYLE3">项目</span> </td>
</tr>
<tr>
<td><input name="checkbox3" type="checkbox" id="checkbox3" value="checkbox" />
<span class="STYLE3">婚嫁</span></td>
<td>
<input type="checkbox" name="checkbox7" value="checkbox" />
<span class="STYLE3">办公室</span></td>
</tr>
<tr>
<td><input name="checkbox4" type="checkbox" id="checkbox4" value="checkbox" />
<span class="STYLE3">病假</span></td>
<td>
<input name="checkbox8" type="checkbox" id="checkbox8" value="checkbox" />
<span class="STYLE3">其他</span></td>
</tr>
</table>
<p> </p>
</form>
</div>
<p> </p>
<p> </p>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>project</title>
<style type="text/css">
<!--
body {
background-color: #00CCFF;
}
.STYLE2 {font-size: 16px; font-weight: bold; }
#Layer1 {
position:absolute;
width:712px;
height:388px;
z-index:1;
left: 104px;
top: 47px;
}
.STYLE3 {font-size: 16px}
-->
</style>
</head>
<body>
<title>project</title>
<table width="40" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../logo.gif" width="50" height="50" /></td>
</tr>
</table>
<br />
<table width="50" height="90" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">周报</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">总表</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2">退出</div></td>
</tr>
</table>
<div id="Layer1">
<form id="form1" name="form1" method="post" action="">
<table width="600" height="66" border="1" cellpadding="0" cellspacing="0" id="1">
<tr>
<td width="123" height="34"><div align="center" class="STYLE2">省份</div></td>
<td width="123"><div align="center" class="STYLE2">运营商</div></td>
<td width="123"><div align="center" class="STYLE2">项目</div></td>
<td width="120"><div align="center" class="STYLE2">项目号</div></td>
<td width="99" bgcolor="#00CCFF"> </td>
</tr>
<tr>
<td height="30"><select name="select1" id="select1" style="width:120px;height:25px" >
<option value="blank" selected="selected"></option>
<option value="HeNan">HeNan</option>
<option value="HeBei">HeBei</option>
<option value="ShanDong">ShanDong</option>
<option value="ZheJiang">ZheJiang</option>
</select>
</td>
<td><select name="select2" id="select2" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="CMCC">CMCC</option>
<option value="CUTC">CUTC</option>
<option value="CTC">CTC</option>
</select>
</td>
<td><select name="select3" id="select3" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="HN CUTC P8.3">HeNan CUTC P8.3</option>
<option value="HN CUTC P9.1">HeNan CUTC P9.1</option>
<option value="HeBei CMCC P12.1">HeBei CMCC P12.1</option>
</select>
</td>
<td><label for="select"></label>
<select name="select4" id="select4" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="1">A020080</option>
<option value="2">B030010</option>
</select>
<label for="select"></label>
<label></label></td>
<td bgcolor="#00CCFF"><div align="center">
<input name="Submit1" type="submit" id="Submit1" value="添加" style="width:55px; height:28px" />
</div></td>
</tr>
</table>
<p> </p>
<table width="589" height="40" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" id="2">
<tr>
<td width="490" bgcolor="#FFFFFF"><input name="textfield1" type="text" id="textfield1" style="height:25px" size="70" /></td>
<td width="99"><div align="center">
<input name="Submi22" type="submit" id="Submi22" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
<tr>
<td bordercolor="#00CCFF" bgcolor="#FFFFFF"><input name="textfield2" type="text" id="textfield2" style="height:25px" size="70" /></td>
<td><div align="center">
<input name="Submit32" type="submit" id="Submit32" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
</table>
<p> </p>
<table width="222" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="109"><input name="checkbox1" type="checkbox" id="checkbox1" value="checkbox" />
<span class="STYLE3">年假</span></td>
<td width="113">
<input name="checkbox5" type="checkbox" id="checkbox5" value="checkbox" />
<span class="STYLE3">丧假</span></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="checkbox" />
<span class="STYLE3">事假</span></td>
<td>
<input name="checkbox6" type="checkbox" id="checkbox6" value="checkbox" />
<span class="STYLE3">项目</span> </td>
</tr>
<tr>
<td><input name="checkbox3" type="checkbox" id="checkbox3" value="checkbox" />
<span class="STYLE3">婚嫁</span></td>
<td>
<input type="checkbox" name="checkbox7" value="checkbox" />
<span class="STYLE3">办公室</span></td>
</tr>
<tr>
<td><input name="checkbox4" type="checkbox" id="checkbox4" value="checkbox" />
<span class="STYLE3">病假</span></td>
<td>
<input name="checkbox8" type="checkbox" id="checkbox8" value="checkbox" />
<span class="STYLE3">其他</span></td>
</tr>
</table>
<p> </p>
</form>
</div>
<p> </p>
<p> </p>
</body>
</html>
解决方案 »
- 简单js效果求教
- 实在是个简单问题,可我却搞不定,关于javascript向flash传参数
- 请问怎么实现用JS给网站上的电影或歌曲地址加密?谢谢
- 输入框的判断
- 被赛尔曲线js
- 能否动态改变一个窗口的statusbar,menubar,toolbar属性,即可以动态设置显示、隐藏工具条等。
- js读取xml字符串的问题,很简单。
- 求助 有一个正则表达式验证不知道怎么写
- 阿信、蓝色街灯、黄蓉、、、、、、、、高手们帮帮忙啊!~~~~~~~
- <script type="text/javascript" src="select.js"></script>
- 有代码,调试出现的对象不存在的情况
- JSP怎么向js传递参数啊,修改js里定义的boolean类型的值
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>project</title>
<style type="text/css">
<!--
body {
background-color: #00CCFF;
}
.STYLE2 {font-size: 16px; font-weight: bold; }
#Layer1 {
position:absolute;
width:712px;
height:388px;
z-index:1;
left: 104px;
top: 47px;
}
.STYLE3 {font-size: 16px}
-->
</style>
<script>
function inputTextArea(e){
e = e ? e : window.event;
var select1=document.getElementById('select1');
var sv1=select1.options[select1.selectedIndex].value;
var select2=document.getElementById('select2');
var sv2=select2.options[select2.selectedIndex].value;
var select3=document.getElementById('select3');
var sv3=select3.options[select3.selectedIndex].value;
var select4=document.getElementById('select4');
var sv4=select4.options[select4.selectedIndex].value;
if(document.getElementById('textfield1').value!=''){
document.getElementById('textfield2').value=sv1+' '+sv2+' '+sv3+' '+sv4;
}else{
document.getElementById('textfield1').value=sv1+' '+sv2+' '+sv3+' '+sv4;
}
}
function clearTextArea(flag,e){
e = e ? e : window.event;
var s='textfield'+flag;
document.getElementById(s).value='';
}
function openHtml(){
var value='';
if(document.getElementById('checkbox1').checked){
value='年假';
}
if(document.getElementById('checkbox2').checked){
value+='事假';
}
if(document.getElementById('checkbox3').checked){
value+='婚假';
}
if(document.getElementById('checkbox4').checked){
value+='病假';
}
if(document.getElementById('checkbox5').checked){
value+='丧假';
}
if(document.getElementById('checkbox6').checked){
value+='项目';
}
if(document.getElementById('checkbox7').checked){
value+='办公事';
}
if(document.getElementById('checkbox8').checked){
value+='其它';
}
window.open('a.html?value='+value);
}
</script>
</head>
<body>
<title>project</title>
<table width="40" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../logo.gif" width="50" height="50" /></td>
</tr>
</table>
<br />
<table width="50" height="90" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">周报</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">总表</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2">退出</div></td>
</tr>
</table>
<div id="Layer1">
<form id="form1" name="form1" method="post" action="" onsubmit="inputTextArea(event);return false;">
<table width="600" height="66" border="1" cellpadding="0" cellspacing="0" id="1">
<tr>
<td width="123" height="34"><div align="center" class="STYLE2">省份</div></td>
<td width="123"><div align="center" class="STYLE2">运营商</div></td>
<td width="123"><div align="center" class="STYLE2">项目</div></td>
<td width="120"><div align="center" class="STYLE2">项目号</div></td>
<td width="99" bgcolor="#00CCFF"> </td>
</tr>
<tr>
<td height="30"><select name="select1" id="select1" style="width:120px;height:25px" >
<option value="blank" selected="selected"></option>
<option value="HeNan">HeNan</option>
<option value="HeBei">HeBei</option>
<option value="ShanDong">ShanDong</option>
<option value="ZheJiang">ZheJiang</option>
</select>
</td>
<td><select name="select2" id="select2" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="CMCC">CMCC</option>
<option value="CUTC">CUTC</option>
<option value="CTC">CTC</option>
</select>
</td>
<td><select name="select3" id="select3" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="HN CUTC P8.3">HeNan CUTC P8.3</option>
<option value="HN CUTC P9.1">HeNan CUTC P9.1</option>
<option value="HeBei CMCC P12.1">HeBei CMCC P12.1</option>
</select>
</td>
<td><label for="select"></label>
<select name="select4" id="select4" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="1">A020080</option>
<option value="2">B030010</option>
</select>
<label for="select"></label>
<label></label></td>
<td bgcolor="#00CCFF"><div align="center">
<input name="Submit1" type="submit" id="Submit1" value="添加" style="width:55px; height:28px" />
</div></td>
</tr>
</table>
<p> </p>
<table width="589" height="40" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" id="2">
<tr>
<td width="490" bgcolor="#FFFFFF"><input name="textfield1" type="text" id="textfield1" style="height:25px" size="70" /></td>
<td width="99"><div align="center">
<input name="Submi22" type="button" id="Submi22" onclick="clearTextArea(1,event)" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
<tr>
<td bordercolor="#00CCFF" bgcolor="#FFFFFF"><input name="textfield2" type="text" id="textfield2" style="height:25px" size="70" /></td>
<td><div align="center">
<input name="Submit32" type="button" id="Submit32" onclick="clearTextArea(2,event)" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
</table>
<p> </p>
<table width="222" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="109"><input name="checkbox1" type="checkbox" id="checkbox1" value="checkbox" />
<span class="STYLE3">年假</span></td>
<td width="113">
<input name="checkbox5" type="checkbox" id="checkbox5" value="checkbox" />
<span class="STYLE3">丧假</span></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="checkbox" />
<span class="STYLE3">事假</span></td>
<td>
<input name="checkbox6" type="checkbox" id="checkbox6" value="checkbox" />
<span class="STYLE3">项目</span> </td>
</tr>
<tr>
<td><input name="checkbox3" type="checkbox" id="checkbox3" value="checkbox" />
<span class="STYLE3">婚嫁</span></td>
<td>
<input type="checkbox" name="checkbox7" value="checkbox" />
<span class="STYLE3">办公室</span></td>
</tr>
<tr>
<td><input name="checkbox4" type="checkbox" id="checkbox4" value="checkbox" />
<span class="STYLE3">病假</span></td>
<td>
<input name="checkbox8" type="checkbox" id="checkbox8" value="checkbox" />
<span class="STYLE3">其他</span></td>
</tr>
</table>
<p> </p>
<input type="button" onclick="openHtml();" value="打开另一个窗口"/>
</form>
</div>
<p> </p>
<p> </p>
</body>
</html>还有一个叫a.html,这两个文件放在同一目录下就能看到效果<html>
<head>
<title>为另一个网页的文本域赋值</title>
<script>
function inputTextArea(){
alert(window.location.href);
var ps=window.location.href.split('?')[1];
document.getElementById('show').value=ps.split('=')[1];
}
</script>
</head>
<body onload="inputTextArea();">
<textarea id="show" rows=30 cols=30>
</textarea>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>project</title>
<style type="text/css">
<!--
body {
background-color: #00CCFF;
}
.STYLE2 {font-size: 16px; font-weight: bold; }
#Layer1 {
position:absolute;
width:712px;
height:388px;
z-index:1;
left: 104px;
top: 47px;
}
.STYLE3 {font-size: 16px}
-->
</style>
<script>
function inputTextArea(e){
e = e ? e : window.event;
var select1=document.getElementById('select1');
var sv1=select1.options[select1.selectedIndex].value;
var select2=document.getElementById('select2');
var sv2=select2.options[select2.selectedIndex].value;
var select3=document.getElementById('select3');
var sv3=select3.options[select3.selectedIndex].value;
var select4=document.getElementById('select4');
var sv4=select4.options[select4.selectedIndex].value;
if(document.getElementById('textfield1').value!=''){
document.getElementById('textfield2').value=sv1+' '+sv2+' '+sv3+' '+sv4;
}else{
document.getElementById('textfield1').value=sv1+' '+sv2+' '+sv3+' '+sv4;
}
}
function clearTextArea(flag,e){
e = e ? e : window.event;
var s='textfield'+flag;
document.getElementById(s).value='';
}
function openHtml(){
var value='';
if(document.getElementById('checkbox1').checked){
value='年假';
}
if(document.getElementById('checkbox2').checked){
value+='事假';
}
if(document.getElementById('checkbox3').checked){
value+='婚假';
}
if(document.getElementById('checkbox4').checked){
value+='病假';
}
if(document.getElementById('checkbox5').checked){
value+='丧假';
}
if(document.getElementById('checkbox6').checked){
value+='项目';
}
if(document.getElementById('checkbox7').checked){
value+='办公事';
}
if(document.getElementById('checkbox8').checked){
value+='其它';
}
window.open('a.html?value='+value);
}
</script>
</head>
<body>
<title>project</title>
<table width="40" height="40" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../logo.gif" width="50" height="50" /></td>
</tr>
</table>
<br />
<table width="50" height="90" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">周报</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2"><a href="../report/reportsummary.html">总表</a></div></td>
</tr>
<tr>
<td><div align="center" class="STYLE2">退出</div></td>
</tr>
</table>
<div id="Layer1">
<form id="form1" name="form1" method="post" action="" onsubmit="inputTextArea(event);return false;">
<table width="600" height="66" border="1" cellpadding="0" cellspacing="0" id="1">
<tr>
<td width="123" height="34"><div align="center" class="STYLE2">省份</div></td>
<td width="123"><div align="center" class="STYLE2">运营商</div></td>
<td width="123"><div align="center" class="STYLE2">项目</div></td>
<td width="120"><div align="center" class="STYLE2">项目号</div></td>
<td width="99" bgcolor="#00CCFF"> </td>
</tr>
<tr>
<td height="30"><select name="select1" id="select1" style="width:120px;height:25px" >
<option value="blank" selected="selected"></option>
<option value="HeNan">HeNan</option>
<option value="HeBei">HeBei</option>
<option value="ShanDong">ShanDong</option>
<option value="ZheJiang">ZheJiang</option>
</select>
</td>
<td><select name="select2" id="select2" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="CMCC">CMCC</option>
<option value="CUTC">CUTC</option>
<option value="CTC">CTC</option>
</select>
</td>
<td><select name="select3" id="select3" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="HN CUTC P8.3">HeNan CUTC P8.3</option>
<option value="HN CUTC P9.1">HeNan CUTC P9.1</option>
<option value="HeBei CMCC P12.1">HeBei CMCC P12.1</option>
</select>
</td>
<td><label for="select"></label>
<select name="select4" id="select4" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="1">A020080</option>
<option value="2">B030010</option>
</select>
<label for="select"></label>
<label></label></td>
<td bgcolor="#00CCFF"><div align="center">
<input name="Submit1" type="submit" id="Submit1" value="添加" style="width:55px; height:28px" />
</div></td>
</tr>
</table>
<p> </p>
<table width="589" height="40" border="0" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF" id="2">
<tr>
<td width="490" bgcolor="#FFFFFF"><input name="textfield1" type="text" id="textfield1" style="height:25px" size="70" /></td>
<td width="99"><div align="center">
<input name="Submi22" type="button" id="Submi22" onclick="clearTextArea(1,event)" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
<tr>
<td bordercolor="#00CCFF" bgcolor="#FFFFFF"><input name="textfield2" type="text" id="textfield2" style="height:25px" size="70" /></td>
<td><div align="center">
<input name="Submit32" type="button" id="Submit32" onclick="clearTextArea(2,event)" style="width:55px; height:28px" value="删除" />
</div></td>
</tr>
</table>
<p> </p>
<table width="222" height="120" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="109"><input name="checkbox1" type="checkbox" id="checkbox1" value="checkbox" />
<span class="STYLE3">年假</span></td>
<td width="113">
<input name="checkbox5" type="checkbox" id="checkbox5" value="checkbox" />
<span class="STYLE3">丧假</span></td>
</tr>
<tr>
<td><input type="checkbox" name="checkbox2" value="checkbox" />
<span class="STYLE3">事假</span></td>
<td>
<input name="checkbox6" type="checkbox" id="checkbox6" value="checkbox" />
<span class="STYLE3">项目</span> </td>
</tr>
<tr>
<td><input name="checkbox3" type="checkbox" id="checkbox3" value="checkbox" />
<span class="STYLE3">婚嫁</span></td>
<td>
<input type="checkbox" name="checkbox7" value="checkbox" />
<span class="STYLE3">办公室</span></td>
</tr>
<tr>
<td><input name="checkbox4" type="checkbox" id="checkbox4" value="checkbox" />
<span class="STYLE3">病假</span></td>
<td>
<input name="checkbox8" type="checkbox" id="checkbox8" value="checkbox" />
<span class="STYLE3">其他</span></td>
</tr>
</table>
<p> </p>
<input type="button" onclick="openHtml();" value="打开另一个窗口"/>
</form>
</div>
<p> </p>
<p> </p>
</body>
</html>
把</head>下面多余的那个<title>XXXX</title>删除。
把添加那个按钮的type="submit"改成type="button" 在按钮里的结束标签之前添加onclick="aa()"。
保存一下就可以了。
<script type="text/javascript">
function aa()
{
var s1=document.getElementById("select1");
var s2=document.getElementById("select2");
var s3=document.getElementById("select3");
var s4=document.getElementById("select4");
var str="";
if(s1.options[s1.selectedIndex].text!="")
str+=(s1.options[s1.selectedIndex].text+" ");
if(s2.options[s2.selectedIndex].text!="")
str+=(s2.options[s2.selectedIndex].text+" ");
if(s3.options[s3.selectedIndex].text!="")
str+=(s3.options[s3.selectedIndex].text+" ");
if(s4.options[s4.selectedIndex].text!="")
str+=(s4.options[s4.selectedIndex].text+" ");
document.getElementById("textfield1").value=str;
}
</script>
function aa()
{
var s1=document.getElementById("select1");
var s2=document.getElementById("select2");
var s3=document.getElementById("select3");
var s4=document.getElementById("select4");
var str="";
if(s1.options[s1.selectedIndex].text!="")
str+=(s1.options[s1.selectedIndex].text+" ");
if(s2.options[s2.selectedIndex].text!="")
str+=(s2.options[s2.selectedIndex].text+" ");
if(s3.options[s3.selectedIndex].text!="")
str+=(s3.options[s3.selectedIndex].text+" ");
if(s4.options[s4.selectedIndex].text!="")
str+=(s4.options[s4.selectedIndex].text+" ");
var t1=document.getElementById("textfield1");
if(t1.value=="")
t1.value=str;
else
document.getElementById("textfield2").value=str;
}
</script>
刚才没看清楚要求。改成这样子。可以实现
当你点击添加按钮的时候,如何把4个下拉列表里面的内容合并在一起输出到textfield1内,如果再点击添加按钮的时候,把4个下拉列表里面的内容合并在一起输出到textfield2内
后面的要求太复杂。要改你网页的内容。。暂时不做了
<option value="blank" selected="selected"></option>
<option value="1">A020080</option>
<option value="2">B030010</option>
</select>因为你这里的option的value只写了1和2,你应该写的跟显示的一样才行
参考你上面的<select name="select3" id="select3" style="width:120px;height:25px">
<option value="blank" selected="selected"></option>
<option value="HN CUTC P8.3">HeNan CUTC P8.3</option>
<option value="HN CUTC P9.1">HeNan CUTC P9.1</option>
<option value="HeBei CMCC P12.1">HeBei CMCC P12.1</option>
</select>
这样就可以了