实现密码手机



你好,我正在做一个新项目。

我想实现一个HTML/CSS/javascript代码来实现移动界面带有Pin代码。好吧,我让你看看,代码很容易理解,但对我来说很难:(

类似:

 <!-- NOCOUNT -->
<!DOCTYPE html>
<html>
<head>
 <script src="https://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, user-scalable=no"/>
</head>

<body>
<div id="container">
<MAP NAME="menu">
<AREA id="Bouton1" SHAPE="rect" COORDS="29,216,148,177" HREF="" >
<!-- <AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(2)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(3)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(4)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(5)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(6)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(7)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(8)">
<AREA SHAPE="rect" COORDS="29,216,148,177" HREF="" onClick="codeEnter(9)"> -->
</MAP>
<IMG SRC="tel.jpg" WIDTH=204 HEIGHT=404 BORDER=0 USEMAP="#menu">
</div>
</body>
<style type="text/css">
body
{
    margin:0 auto;
    background-color:#000;
}

#container
    {
        display:block ;
        position: absolute;
        top: 50%;
        left: 50%;
        margin-left: -512px;
        margin-top: -384px;
        margin-right:-512px;
        width:1024px;
        height:768px;
        padding: 0;
        border: 0;
        z-index:1;
        background:url();
    }

</style>
<script>
var code= "1111";
var formulaire="";
var compteur=0;
$("#Bouton1").click( function(){
        compteur++;
        formulaire = formulaire + "1";
        if(compteur == 4){
              alert(code.toString());
        }    
    });
</script>
</html>

但它不起作用,有什么帮助吗?

  1. 您错过了代码周围的<html></html>标记和页面内容周围的<body></body>标记
  2. 正确的语法是id="1",而不是id=1

  3. 您没有插入jQuery(使用$()<head></head>内部插入

    <script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
    <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    
  4. 可选,但标签必须用小写书写

编辑:

$("#1").click( function(){
        compteur++;
        fomulaire = fomulaire + "1";
        if(compteur == 4){
              alert(code.toString());
        }    
    });
`

最新更新