日期:2014-05-16  浏览次数:20636 次

怎么在软键盘0-9后面加上一个退格键呢?
麻烦在下面的代码基础上修改下。谢谢!
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>卡路里</title>
<style>
ul,input{margin:0;padding:0;}
li{list-style:none;}
.text{float:left;border:solid 1px #ccc;height:28px;line-height:28px;width:200px; background:none;}
.box{width:200px;position:relative; float:left; margin-right:20px;}
.key{width:140px;overflow:hidden; height:150px;position:absolute; top:30px;padding:10px;background:#FFC;}
.key ul{ float:left;width:150px;height:160px;}
.key ul li{float:left;width:38px;text-align:center;height:28px;line-height:28px;border:solid 1px #ccc; display:inline;margin-right:10px;margin-bottom:10px; cursor:pointer;}
.btn{float:left;margin:0 20px;height:28px;line-height:28px; width:100px;text-align:center; }
.sum{float:left;height:28px;line-height:28px;}
</style>
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
<script>
$(function(){
    var keyStr='<div class="key">'
            +'<ul>'
            +'    <li>0</li>'
            +'    <li>1</li>'
            +'    <li>2</li>'
            +'    <li>3</li>'
            +'    <li>4</li>'
            +'    <li>5</li>'
            +'    <li>6</li>'
            +'    <li>7</li>'
            +'    <li>8</li>'
            +'    <li>9</li>'
            +' </ul>'
            +'</div>';
            $('.box').delegate('li','click',function(){
                var oText=$(this).parents('.box').find('.text');
                oText.val(oText.val()+$(this).html());
            });
            $('.box').mouseenter(function(){
                $(this).append(keyStr);