永发信息网

急需!求一个网页中的虚拟键盘源码

答案:1  悬赏:50  手机版
解决时间 2021-05-10 11:12

求一个网页表单中的虚拟快捷键按钮源码

最佳答案

javascript模拟虚拟键盘 网上找的 希望对你有用


<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>softkeyboard:code by meixx</title>
<script language="javascript">
var oPopUp=null;
function SoftKeyboard(pwdObj){
oPopUp=window.createPopup();
var popBody=oPopUp.document.body;
popBody.style.backgroundColor = "#FFFF99";
popBody.style.border = "solid black 1px";
WriteToPopup(oPopUp,pwdObj);
oPopUp.show(0,22,325,136,pwdObj);
}
function WriteToPopup(oPopUp,pwdObj){
var strHTML="<html><head>";
strHTML+='<meta http-equiv="Content-Type" content="text/html; charset=gb2312">';
strHTML+='<style type="text/css">';
strHTML+='.tdnormal{text-align:center; background-image:url(images/bz.GIF); font:13px; color:black; background-repeat:no-repeat; background-position:100% 100%}';
strHTML+='.tdover{text-align:center; background-image:url(images/z.GIF); font:13px; color:black}';
strHTML+='.tdclick{text-align:center; background-image:url(images/zz.GIF); font:13px; color:white}';
strHTML+='.button{border:0;width:90%; height:95%; }';
strHTML+='</style>';
strHTML+='<script language="javascript">';
strHTML+='var arrLow=new Array("`","1","2","3","4","5","6","7","8","9","0","-","=","\\\\","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","[","]",";","\'",",",".","/","");';
strHTML+='var arrUp =new Array("~","!","@","#","$","%","^","&","*","(",")","_","+","|","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","{","}",":","\\"","<",">","?",""); ';
strHTML+='var curOverTd=null; var curClkTd=null; var CapsStatus="black";';
strHTML+='var pwdObjectId=parent.document.getElementById("'+pwdObj.id+'");';
strHTML+='function TdMouseOver(TdObj){ ';
strHTML+=' TdObj.className ="tdover"; ';
strHTML+=' curOverTd=TdObj;} ';
strHTML+='function TdMouseOut(TdObj){ ';
strHTML+=' if(curClkTd==TdObj)';
strHTML+=' TdObj.className ="tdclick"; ';
strHTML+=' else';
strHTML+=' TdObj.className ="tdnormal"; ';
strHTML+=' } ';
strHTML+='function TdMouseClk(TdObj){ ';
strHTML+=' if(curClkTd)';
strHTML+=' curClkTd.className ="tdnormal"; ';
strHTML+=' TdObj.className ="tdclick"; ';
strHTML+=' curClkTd=TdObj; ';
strHTML+=' curOverTd=null; ';
strHTML+=' pwdObjectId.value+=TdObj.innerText;';
strHTML+=' }';
strHTML+=' function btnCapsDown(btnObj){';
strHTML+=' if(CapsStatus=="black"){ CapsStatus="green"; ChgText(arrUp);}';
strHTML+=' else{ CapsStatus="black"; ChgText(arrLow);}; ';
strHTML+=' btnObj.style.color=CapsStatus=="black"?"#000000":"#33FF66";';
strHTML+=' if(curClkTd){ if(curClkTd.className=="tdclick") curClkTd.className="tdnormal"; else curClkTd.className="tdclick"; }';
strHTML+=' btnObj.style.color=CapsStatus=="black"?"#000000":"#33FF66";';
strHTML+=' }';
strHTML+=' function ChgText(arr){';
strHTML+=' var table=document.getElementById("tbKeyboard");';
strHTML+=' for(var i=0;i<4;i++)';
strHTML+=' for(var j=0;j<12;j++)';
strHTML+=' table.rows[i].cells[j].innerText=arr[12*i+j];';
strHTML+=' }';
strHTML+=' function btnSpaceDown(){';
strHTML+=' pwdObjectId.value+=" "';
strHTML+=' }';
strHTML+=' function btnBackDown(){';
strHTML+=' pwdObjectId.value=pwdObjectId.value.substring(0,pwdObjectId.value.length-1)';
strHTML+=' }';
strHTML+=' function btnEnterDown(){';
strHTML+=' parent.oPopUp.hide();';
strHTML+=' }';
strHTML+='</scr'+'ipt></head> ';
strHTML+='<body bgcolor="#FFFFFF" oncontextmenu="javascript:event.returnValue=false;" onselectstart="javascript:event.returnValue=false;"> ';
strHTML+='<table id="tbKeyboard" cellpadding="0" cellspacing="0" border="1" bordercolor="#FFFFFF">';
var arr=new Array("`","1","2","3","4","5","6","7","8","9","0","-","=","\\","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","[","]",";","\'",",",".","/","");
for(var i=0;i<4;i++){
strHTML+='<tr height="27">';
for(var j=0;j<12;j++)
strHTML+='<td class="tdnormal" valign="middle" onMouseOver="TdMouseOver(this)" onMouseOut="TdMouseOut(this)" onClick="TdMouseClk(this)">'+arr[i*12+j]+'</td>';
strHTML+='</tr">';
}
strHTML+='<tr height=""><td class="tdnormal" colspan="12"><table width="100%" border="0" cellpadding="0" cellspacing="0" >';
strHTML+='<tr><td class="tdnormal" width="20%" valign="middle"><input type="button" value="Shift" onclick="btnCapsDown(this)" class="button"></td>';
strHTML+='<td class="tdnormal" width="35%" valign="middle"><input type="button" value="Space" onclick="btnSpaceDown()" class="button"></td>';
strHTML+='<td class="tdnormal" width="25%" valign="middle"><input type="button" value="Back" onclick="btnBackDown()" class="button"></td>';
strHTML+='<td class="tdnormal" width="20%" valign="middle"><input type="button" value="Enter" onclick="btnEnterDown()" class="button"></td>';
strHTML+='</tr></table></td>';
strHTML+='</tr></table></body></html>';
oPopUp.document.write(strHTML);
}
</script>
</head>

<body onload="javascript:txtPwd.click()">
<input type="text" id="txtPwd" name="txtPwd" onclick="SoftKeyboard(this)" readonly="readonly">
</body>
</html>

我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
玫瑰花的葬礼谁唱的?
十点之后去火车站买第二天的车票能买到么?
刚刚把我DNF50粉太流星落强13 能值多少RMB?
我是红钻,手机怎么换qq 秀
哈利波特7精装版 money多少
老不学的下语句是什么,if的句子是什么句子
我学设计没有立体感怎么办?
丝丝心动全集21 丝丝心动全集大结局下载 丝丝
怎样知道主板能不能开核?
一个QQ校友头像的问题
某同学把一只长15cm的钢尺紧压在课桌边,拨动
乌龟被咬伤腿溃烂了怎么办?
前两天低烧头痛,现在是第三天却感觉嗓子疼,
百度里说的都做了 ,农场还是进不去。?- -!
万州机场的问题
推荐资讯
我的牧场的仓库和商店为什么无法访问。
中国的NB球队什么时候出世
目前 商业银行哪家的好
七雄争霸9-10官府要几级城池?
从失恋中释怀了句子,失恋后,想要去旅游的伤感
为什么我的手机不能进入我的博客?
蛇眼和碧影哪个好?
其中有一句是 和你慢慢变老 有谁知道这首歌名
Nokia3208C一连接USB就白屏
占卜我的爱情和工作,我阳历1987.06.13出生
(月舞云袖)是墨明棋妙里谁唱的男生版的
30公斤的水桶能装多少升柴油
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?