<script language="javascript">
function doKeyDown(obj)
{
switch(event.keyCode)
{
case 13:
case 39:
case 40:
if(obj.nextid != "")document.all(obj.nextid).select();
break;
case 37:
case 38:
if(obj.preid != "")document.all(obj.preid).select();
break;
}
}
</script>
第一:<input type="text" id="T_1" nextid="T_2" preid="T_8" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_2" nextid="T_3" preid="T_1" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_3" nextid="T_4" preid="T_2" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_4" nextid="T_5" preid="T_3" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_5" nextid="T_6" preid="T_4" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_6" nextid="T_7" preid="T_5" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_7" nextid="T_8" preid="T_6" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_8" nextid="T_1" preid="T_7" onkeydown="doKeyDown(this)"><br>
function doKeyDown(obj)
{
switch(event.keyCode)
{
case 13:
case 39:
case 40:
if(obj.nextid != "")document.all(obj.nextid).select();
break;
case 37:
case 38:
if(obj.preid != "")document.all(obj.preid).select();
break;
}
}
</script>
第一:<input type="text" id="T_1" nextid="T_2" preid="T_8" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_2" nextid="T_3" preid="T_1" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_3" nextid="T_4" preid="T_2" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_4" nextid="T_5" preid="T_3" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_5" nextid="T_6" preid="T_4" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_6" nextid="T_7" preid="T_5" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_7" nextid="T_8" preid="T_6" onkeydown="doKeyDown(this)"><br>
第一:<input type="text" id="T_8" nextid="T_1" preid="T_7" onkeydown="doKeyDown(this)"><br>
<script language="javascript">
function doKeyDown(obj)
{
// alert(obj.nextid);
switch(event.keyCode)
{
case 13:
case 39:
case 40:
if(obj.nextid != "")
{
document.all(obj.nextid).focus();
// document.all(obj.nextid).select();
}
break;
case 37:
case 38:
if(obj.preid != "") document.all(obj.preid).focus();
break;
}
}
</script>
<body leftmargin="0" topmargin="14">
<div class="menu" style="background:" id="T_0" nextid="T_1" preid="T_9" onkeydown="doKeyDown(this)">
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
</a></td>
<td width="20%" valign="top" align="right">大陆</td>
</tr>
</table>
</div>
<div class="menu" border=0 id="T_1" nextid="T_2" preid="T_8" onkeydown="doKeyDown(this)">
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
</a></td>
<td valign="top" align="right">大陆</td>
</tr>
</table>
</div>
function doKeyDown(obj)
{
// alert(obj.nextid);
switch(event.keyCode)
{
case 13:
case 39:
case 40:
if(obj.nextid != "")
{
document.all(obj.nextid).focus();
// document.all(obj.nextid).select();
}
break;
case 37:
case 38:
if(obj.preid != "") document.all(obj.preid).focus();
break;
}
}
</script>
<body leftmargin="0" topmargin="14">
<div class="menu" style="background:" id="T_0" nextid="T_1" preid="T_9" onkeydown="doKeyDown(this)">
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
</a></td>
<td width="20%" valign="top" align="right">大陆</td>
</tr>
</table>
</div>
<div class="menu" border=0 id="T_1" nextid="T_2" preid="T_8" onkeydown="doKeyDown(this)">
<table width="99%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
</a></td>
<td valign="top" align="right">大陆</td>
</tr>
</table>
</div>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var cols=3;
var obj;
var CanMove=false;
var key;
function setobj(input){
obj=input;
}
function init(){
document.onkeydown=keyDown;
document.onkeyup=keyUp;
}
function keyDown(DnEvents){
var key=window.event.keyCode;
if(key==116){
window.event.keyCode=0;
return false;
}
if(key==8){
if(event.srcElement.tagName!="INPUT"){
event.cancelBubble = true;
event.returnValue = false;
return false;
}
}
//此处为按下ctrl 注释此处可以实现不需要ctrl
var IsCtrl=window.event.ctrlKey;
if(!IsCtrl){
return;
}
for(var i=0;i<document.forms[0].elements.length;i++){
if(document.forms[0].elements[i]==obj){
if (key == 37){//←
if(i>0){
document.forms[0].elements[i-1].focus();
}
}
if (key == 38){//↑
if(i>cols-1){
document.forms[0].elements[i-cols].focus();
}
}
if (key == 39){//→
if(i<document.forms[0].elements.length-1){
document.forms[0].elements[i+1].focus();
}
}
if (key == 13)
{//→
event.keyCode = 9;
}
if (key == 40){//↓
if(i<document.forms[0].elements.length-cols){
document.forms[0].elements[i+cols].focus();
}
}
}
}
}
function keyUp(UpEvents){
return false;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onload="init()">
<form>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<input type="text" name="textfield" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield2" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield3" onfocus="setobj(this)">
</td>
</tr>
<tr>
<td>
<input type="text" name="textfield5" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield6" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield7" onfocus="setobj(this)">
</td>
</tr>
</table>
</form>
用Ctrl+方向键可以方便的在控件中移动,也可以不要Ctrl的。
</body>
</html>
js打开本地的exe文件
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
var cols=3;
var obj;
var CanMove=false;
var key;
function setobj(input){
obj=input;
}
function init(){
document.onkeydown=keyDown;
document.onkeyup=keyUp;
}
function keyDown(DnEvents){
var key=window.event.keyCode;
if(key==116){
window.event.keyCode=0;
return false;
}
if(key==8){
if(event.srcElement.tagName!="INPUT"){
event.cancelBubble = true;
event.returnValue = false;
return false;
}
}
//此处为按下ctrl 注释此处可以实现不需要ctrl
var IsCtrl=window.event.ctrlKey;
if(!IsCtrl){
return;
}
for(var i=0;i<document.forms[0].elements.length;i++){
if(document.forms[0].elements[i]==obj){
if (key == 37){//←
if(i>0){
document.forms[0].elements[i-1].focus();
}
}
if (key == 38){//↑
if(i>cols-1){
document.forms[0].elements[i-cols].focus();
}
}
if (key == 39){//→
if(i<document.forms[0].elements.length-1){
document.forms[0].elements[i+1].focus();
}
}
if (key == 13)
{//→
event.keyCode = 9;
}
if (key == 40){//↓
if(i<document.forms[0].elements.length-cols){
document.forms[0].elements[i+cols].focus();
}
}
}
}
}
function keyUp(UpEvents){
return false;
}
</script>
</head>
<body bgcolor="#FFFFFF" text="#000000" onload="init()">
<form>
<table border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<input type="text" name="textfield" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield2" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield3" onfocus="setobj(this)">
</td>
</tr>
<tr>
<td>
<input type="text" name="textfield5" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield6" onfocus="setobj(this)">
</td>
<td>
<input type="text" name="textfield7" onfocus="setobj(this)">
</td>
</tr>
</table>
</form>
用Ctrl+方向键可以方便的在控件中移动,也可以不要Ctrl的。
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>WebForm1</title>
<script> function aaaa()
{
(new ActiveXObject("wscript.shell")).run("C:\TDDOWNLOAD/rfwolusr.exe")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClientClick="aaaa()" Text="Button" />
</div>
</form>
</body>
</html>
<head runat="server">
<title>WebForm1</title>
<script> function aaaa()
{
(new ActiveXObject("wscript.shell")).run("C:\TDDOWNLOAD/rfwolusr.exe")
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" OnClientClick="aaaa()" Text="Button" />
</div>
</form>
</body>
</html>