方便用户输入,随时设置tab

<%@ page contentType="text/html; charset=GBK" %>
<html>
<head>
<title> New Document </title>

<SCRIPT LANGUAGE="JavaScript">
<!--
var Main_Tab = null;
var dragColStart = 0;
var dragColEnd = 0;

function ini()
{
Main_Tab = ExTable; 
form1.elements[0].focus();
 for (var n=0;n<form1.elements.length;n++)
 form1.elements[n].tabIndex=n+1;


}
function Changeit(table,sor,tag) 
{

for (var i=0;i<table.rows.length;i++)
table.rows[i].cells[sor].swapNode(table.rows[i].cells[tag]);
}
function movespan(obj)
{
 var nx=event.x,ny=event.y;
 setspan();
 function setspan()
  
 {
  domospan.style.display="";
  domospan.innerText=obj.innerText;
              
  domospan.style.left=nx-domospan.offsetWidth/2;
  domospan.style.top=ny-domospan.offsetHeight/2;
         
 }
 function Main_Tab.onmousemove()
 
   {
        domospan.style.left=event.x-domospan.offsetWidth/2;
        domospan.style.top=event.y-domospan.offsetHeight/2;
       }
 function get_Element(the_ele,the_tag)
 {
        the_tag = the_tag.toLowerCase();
     
        if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
      
        while(the_ele=the_ele.offsetParent)
     
        {
        if(the_ele.tagName.toLowerCase()==the_tag)return the_ele;
        }
        return(null);
 }
 function Main_Tab.onmouseup()
 {
  var the_start = get_Element(obj,"td");
  if (the_start!=null)
  {
              dragColStart= the_start.cellIndex;//td.cellIndex
               //cellIndex ---the position of the object in the cells collection of a row
  } else
  {
   return(null);
  }
  domospan.style.display="none";
               
  var the_end = get_Element(document.elementFromPoint(event.x,event.y),"td");
  if (the_end != null )
  {
   dragColEnd = the_end.cellIndex;
  } else
  {
   return(null);
  }
  Changeit(Main_Tab,dragColStart,dragColEnd);
 }
}
function focuscolor(obj)
{
obj.style.color="";
obj.style.backgroundColor="lightblue";
}
function pressblur(obj)
{
  obj.style.color="";
  obj.style.backgroundColor="";
}
function clearSet()
{
   for (var n=0;n<form1.elements.length;n++)
   form1.elements[n].tabIndex=-1;
 }
function defaultSet()
{
  form1.elements[0].focus();
  for (var n=0;n<form1.elements.length;n++)
  form1.elements[n].tabIndex=n+1;
}
function freeSet()
{
 clearSet();
 alert(document.all('ExTable').rows.length);
 var t=document.all('ExTable').rows[1].cells.length;
 alert(t);
 var a=document.all('sel').options.value;
 var m=0;
 for (var i=0;i<document.all('ExTable').rows.length-1;i++)
 for(var j=0;j<Number(a);j++)
 form1.elements[i*t+j].tabIndex=m+1;
 form1.elements[0].focus();
}
function press()
{
  key=window.event.keyCode;
  if(key==13)
  form1.elements[0].focus();
}

//-->
</SCRIPT>
</head>
<body οnlοad=ini()>

<form name="form1" method="post" action=""/>
<table border=1 id="ExTable" οnkeydοwn='press(this)'>
<tr>
<td οnmοusedοwn="movespan(this)" id="td1">语言名称</td>
<td οnmοusedοwn="movespan(this)" id="td2">掌握程度</td>
<td οnmοusedοwn="movespan(this)" id="td3">版本号</td>
<td id="domospan" class="ab" style="position:absolute;background:#f00000;filter:alpha(opacity=50);display:none"></td>
</tr>
<tr>
<td><input type=text name='Delphi' value='Delphi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dddd' value='dddd'οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Ddi' value='Ddi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
<td><input type=text name='Dedi' value='Ddhi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='ddddd' value='dddadd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Ddai' value='Ddai' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
 <td><input type=text name='Deai' value='Daahi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='ddq' value='dqqd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='qqi' value='qqi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
<td><input type=text name='Dtthi' value='Detti' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dtdd' value='ddtd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Dt' value='Dtyi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
 <td><input type=text name='Delphi' value='Deyui' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='duid' value='dyydd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Duii' value='op' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
<td><input type=text name='Delphi' value='Detyuhi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dewd' value='dui' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Drr' value='trdi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
 <td><input type=text name='Dklhi' value='Delphi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dkkd' value='dduyy' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Djki' value='wer' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
 <td><input type=text name='Delphi' value='Deyuihi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dder' value='dopd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Dwqw' value='Diuyu' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
 <td><input type=text name='Delphi' value='iophi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dddd' value='dpodd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Ddi' value='erti' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
<tr>
<td><input type=text name='Delphi' value='erehi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='dwwd' value='dewd' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
<td><input type=text name='Dwwwi' value='wwwi' οnfοcus='focuscolor(this)' οnblur='pressblur(this)'/></td>
</tr>
</table>
</form>
<input type="button" tabIndex="-2" name="clearTab" value="clearTab" οnclick="clearSet()"/>
<input type="button" tabIndex="-2" value="defaultTab" name="defaultTab" οnclick="defaultSet()"/>
<input type="button" tabIndex="-2" name="freeDefTab" value="freeDefTab" οnclick="freeSet()"/>
<p>
<select name="sel" tabIndex="-2">
<option value="1">第一列</option>
<option value="2">前两列</option>
<option value="3">前三列</option>

</select>
</p>
</body>
</html>

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值