//定义当前是否大写的状态
window.onload=function(){
password1=null;
setcalcbuttonbg();
}
function $(doc){return document.getelementbyid(doc)}
var capslockvalue=0;
document.write("");
document.write("
");
//给输入的密码框添加新值
function addvalue(newvalue) {
if (capslockvalue==0) {
calc.password.value += newvalue;
}
else {
calc.password.value += newvalue.touppercase();
}
password1.value=calc.password.value;
}
//实现backspace键的功能
function setpassvalue() {
var longnum=calc.password.value.length;
var num
num=calc.password.value.substr(0,longnum-1);
calc.password.value=num;
var str=calc.password.value;
password1.value=calc.password.value;
}
//输入完毕
function overinput() {
var str=calc.password.value;
password1.value=calc.password.value;
softkeyboard.style.display="none";
calc.password.value="";
password1.readonly=0;
}
//关闭软键盘
function closekeyboard() {
password1.readonly=0;
password1.focus();
softkeyboard.style.display="none";
password1.value="";
}
//显示软键盘
function showkeyboard(event) {
softkeyboard.style.top=(event.clienty+document.body.scrolltop+15)+"px";
if(parseint(event.clientx-390)>0) {
softkeyboard.style.left=(event.clientx-390)+"px";
}
else {
softkeyboard.style.left=0;
}
calc.password.value="";
softkeyboard.style.display="block";
password1.readonly=1;
password1.blur();
password1.value="";
}
//设置是否大写的值
function setcapslock() {
if(capslockvalue==0) {
capslockvalue=1
}
else {
capslockvalue=0
}
}
function setcalcbuttonbg() {
for(var i=0;i="a" && char<="z" && char.length==1) {
calc.elements[i].value=" "+string.fromcharcode(char.charcodeat(0)-32)+" "
}
}
}
else
{
for(var i=0;i="a" && char<="z" && char.length==1) {
calc.elements[i].value=" "+string.fromcharcode(char.charcodeat(0)+32)+" "
}
}
}
capslockflag=!capslockflag;
}
function checkkeyboard(inputobj,event){
inputobj.value="";
password1=inputobj;
showkeyboard(event);
inputobj.readonly=1;
}
/*-------------------------鼠标拖动---------------------*/
var od = $("keyboardtitle");
var odcontent = $("softkeyboard");
var dx,dy,mx,my,moused;
var odrag;
var isie = document.all ? true : false;
document.onmousedown = function(e){
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0)) {
moused = true;
}
}
document.onmouseup = function(){
moused = false;
odrag = "";
if(isie){
od.releasecapture();
odcontent.filters.alpha.opacity = 100;
}
else{
window.releaseevents(od.mousemove);
odcontent.style.opacity = 1;
}
}
//function readymove(e){
od.onmousedown = function(e){
odrag = this;
var e = e ? e : event;
if(e.button == (document.all ? 1 : 0)){
mx = e.clientx;
my = e.clienty;
od.style.left = od.offsetleft + "px";
od.style.top = od.offsettop + "px";
if(isie){
od.setcapture();
odcontent.filters.alpha.opacity = 70;
}
else{
window.captureevents(event.mousemove);
odcontent.style.opacity = 0.7;
}
}
}
document.onmousemove = function(e){
var e = e ? e : event;
if(moused==true && odrag){
var mrx = e.clientx - mx;
var mry = e.clienty - my;
od.style.left = parseint(od.style.left) +mrx + "px";
od.style.top = parseint(od.style.top) + mry + "px";
odcontent.style.left = parseint(odcontent.style.left) +mrx + "px";
odcontent.style.top = parseint(odcontent.style.top) + mry + "px";
mx = e.clientx;
my = e.clienty;
}
}