3つのリストの値を選択して他のselect 1に追加し、select 1の内容をバックグラウンドに提出します.
7478 ワード
<select id="hereFirstClass" name="hereFirstClass" style="width:130"
size="8" onchange="testName(1,this);">
<option value="2"> 、 </option>
<option value="3"> </option>
<option value="4"> 、 </option>
<option value="5"> </option>
<option value="6"> </option>
<option value="7"> 、 </option>
<option value="8"> </option>
<option value="9"> </option>
<option value="10"> </option>
<option value="11"> </option>
<option value="12"> </option>
<option value="13"> 、 </option>
<option value="14"> </option>
<option value="15"> </option>
<option value="16"> 、 </option>
<option value="17"> 、 、 </option>
<option value="18"> 、 </option>
<option value="21"> 、 </option>
<option value="23"> </option>
<option value="30"> 、 </option>
<option value="32"> </option>
<option value="33"> </option>
<option value="34"> </option>
<option value="52"> </option>
<option value="53"> 、 </option>
<option value="54"> </option>
<option value="55"> </option>
<option value="56"> </option>
<option value="57"> </option>
<option value="58"> </option>
<option value="59"> 、 </option>
<option value="509"> </option>
<option value="1813"> </option>
<option value="2829"> </option>
<option value="10208"> </option>
</select>
<select id="hereSecondClass" name="hereSecondClass" style="width:130"
size="8" onchange="testName(2,this);">
</select>
<select id="hereThirdClass" name="hereSecondClass" style="width:130"
size="8" onchange="testName(3,this);">
</select>
<div class="add_Delete"><input type="button" value="↓ " onclick="addline()"/>
<input type="button" value="x " onclick="delline()"/></div>
<script type="text/javascript" >
function addline() {
var num = document.getElementById("select1");
if(num.length>5) {
alert(" 6 ");
return false;
}
var obj;
obj = document.createElement("option");
var obj1 = document.getElementById("hereFirstClass");
var obj2 = document.getElementById("hereSecondClass");
var obj3 = document.getElementById("hereThirdClass");
if(document.getElementById("hereFirstClass").value=="") {
alert(" ");
return false;
}
var hereFirstValue = document.getElementById("hereFirstClass").value;
var hereFirstName = document.getElementById("hereFirstClass").options[obj1.selectedIndex].text;
if(document.getElementById("hereSecondClass").value=="") {
obj.value = hereFirstValue;
obj.text = hereFirstName;
document.getElementById("select1").add(obj);
}else if(document.getElementById("hereThirdClass").value=="") {
var hereSecondValue = document.getElementById("hereSecondClass").value;
var hereSecondName = document.getElementById("hereSecondClass").options[obj2.selectedIndex].text;
obj.value = hereFirstValue+"//"+hereSecondValue;
obj.text = hereFirstName+"//"+hereSecondName;
document.getElementById("select1").add(obj);
}else{
var hereThirdValue = document.getElementById("hereThirdClass").value;
var hereThirdName = document.getElementById("hereThirdClass").options[obj3.selectedIndex].text;
var hereSecondValue = document.getElementById("hereSecondClass").value;
var hereSecondName = document.getElementById("hereSecondClass").options[obj2.selectedIndex].text;
obj.value = hereFirstValue+"//"+hereSecondValue+"//"+hereThirdValue;
obj.text = hereFirstName+"//"+hereSecondName+"//"+hereThirdName;
document.getElementById("select1").add(obj);
}
}
function delline() {
document.all.select1.options.remove(document.all.select1.selectedIndex);
document.all.select1.selectIndex=0;
}
</script>
<table width="460" name="table3" id="table3" >
<select size="8" name="select1" id="select1" multiple="true">
</select>
</table>
//------------------------ javascript
<script type="text/javascript">
function refer() {
var op = document.getElementById("select1").getElementsByTagName("option");
if(op.length<0) {
alert(" ");
return false;
}else {
for(var i=0; i<op.length; i++) {
var str = "input"+i;
document.getElementById(str).value = op[i].childNodes[0].nodeValue;
}
}
document.form1.action="/HereB2B/corporate?method=insertCorporate";
document.form1.submit();
}
</script>