最近有人做js的学习吗?

woleve 2006-11-23
找个人和我一起学习下
ASDF1982 2006-11-23
我也想学习学习呀,最好在一起研究研究ajax 可惜我是个新手啊(:
ASDF1982 2006-11-30
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script type="text/javascript">
   var allCount=1;
function addLine(value1,value2)
{
  
   crTr = PO.insertRow();
   crTr.id="wert";
   crTr.ln=allCount;
   crtd1 =crTr.insertCell(0);
   crtd1.innerHTML="<input name='fountain' readonly  size=40 type =text  value="+value1+ " >";
   crtd2 =crTr.insertCell(1);
   crtd2.innerHTML="<input name='aim' readonly size=40 type =text  value="+value2+" >";
   crtd3 =crTr.insertCell(2); 
   crtd3.innerHTML="<input name=11 readonly type =button  value=取消 onclick='deleteLine("+allCount+" )';>";
   allCount++;
}
function mapping()
{
    var sel1 = document.forms[0].sel1;
var sel2 = document.forms[0].sel2;
   if(document.forms[0].sel1.length==0)
   {
     alert("请选中表!");
return false;
   }
     
      addLine(sel1.options[sel1.selectedIndex].text,sel2.options[sel1.selectedIndex].text);
 
      //document.forms[0].sel1.options=null;
  sel1.options[sel1.selectedIndex]=null;
  sel1.options.selected; 
      sel2.options[sel2.selectedIndex]=null; 
  sel2.options.selected;   
}
function deleteLine(index)
{
   var sel1 = document.forms[0].sel1;
   var sel2 = document.forms[0].sel2;
   value1 =document.forms[0].fountain[index-1].value;
   value2 =document.forms[0].aim[index-1].value;
   var newOption1 = new Option;
   var newOption2 = new Option;
   newOption1.text = value1;
   newOption1.value = value1;
   newOption2.text = value2;
   newOption2.value = value2;
   sel1.add(newOption1);
   sel2.add(newOption2);
   PO.deleteRow(index);
   allCount--;
}
</script>
<body>
<form>
<table align="center">
<tr>
<select name="sel1">
<option value="a1">A1</option>
<option value="a2">A2</option>
<option value="a3">A3</option>
</select>
<td><input type="button" value="映射" onClick="mapping();"/></td>
<td>
<select name="sel2">
<option value="b1">B1</option>
<option value="b2">B2</option>
<option value="b3">B3</option>
</select>
</td>
</tr>
</table>
<table align="center" width="700" height="30" ><tr><td></td></tr></table>
<table id="PO" align="center" width="700" rules="rows" >
<tr  id='tdt' bgColor="#006666">
<th>
          <FONT color='white'>Fountain </FONT>
   </th>
        <th align="center" >
          <FONT color='white'>Aim </font>
</th>
<th width="10%">
<FONT color=white>Remove
          </FONT>
</th>
      </tr>
</table>
</form>
</body>
</html>

刚刚写的一个option操作的javascript 但是不能正常删除 因为document.forms[0].fountain[index-1].value在不按顺序删除的情况下 拿不到值,看看怎么处理呀
woleve 2006-11-30
公司掉线了,刚上来,马上离岗了。拿回家看看
wangzhongjie 2007-07-09
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script type="text/javascript">
var allCount=1;
function addLine(value1,value2)
{

crTr = PO.insertRow();
crTr.id="wert";
crTr.ln=allCount;
crtd1 =crTr.insertCell(0);
crtd1.innerHTML="<input name='fountain' readonly size=40 type =text value="+value1+ " >";
crtd2 =crTr.insertCell(1);
crtd2.innerHTML="<input name='aim' readonly size=40 type =text value="+value2+" >";
crtd3 =crTr.insertCell(2);
crtd3.innerHTML="<input name=11 readonly type =button value=取消 onclick='deleteLine("+allCount+" )';>";
allCount++;
}
function mapping()
{
var sel1 = document.forms[0].sel1;
var sel2 = document.forms[0].sel2;
if(document.forms[0].sel1.length==0)
{
alert("请选中表!");
return false;
}

addLine(sel1.options[sel1.selectedIndex].text,sel2.options[sel1.selectedIndex].text);

//document.forms[0].sel1.options=null;
sel1.options[sel1.selectedIndex]=null;
sel1.options.selected;
sel2.options[sel2.selectedIndex]=null;
sel2.options.selected;
}
function deleteLine(index)
{
var sel1 = document.forms[0].sel1;
var sel2 = document.forms[0].sel2;
value1 =document.all("PO").rows[index].cells[0].children[0].value;
value2 =document.all("PO").rows[index].cells[1].children[0].value;

var newOption1 = new Option;
var newOption2 = new Option;
newOption1.text = value1;
newOption1.value = value1;
newOption2.text = value2;
newOption2.value = value2;
sel1.add(newOption1);
sel2.add(newOption2);
PO.deleteRow(index);
allCount--;
}
</script>
<body>
<form>
<table align="center">
<tr>
<select name="sel1">
<option value="a1">A1</option>
<option value="a2">A2</option>
<option value="a3">A3</option>
</select>
<td><input type="button" value="映射" onClick="mapping();"/></td>
<td>
<select name="sel2">
<option value="b1">B1</option>
<option value="b2">B2</option>
<option value="b3">B3</option>
</select>
</td>
</tr>
</table>
<table align="center" width="700" height="30" ><tr><td></td></tr></table>
<table id="PO" align="center" width="700" rules="rows" >
<tr id='tdt' bgColor="#006666">
<th>
<FONT color='white'>Fountain </FONT>
</th>
<th align="center" >
<FONT color='white'>Aim </font>
</th>
<th width="10%">
<FONT color=white>Remove
</FONT>
</th>
</tr>
</table>
</form>
</body>
</html>

Global site tag (gtag.js) - Google Analytics