我也来一个趣味javascript:
打开以下html文件,依次按下G,L,C三个键,就会有奇迹出现!!<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>趣味javascript</title>
</head>
<script>
var Gkey=false,Lkey=false,Ckey=false;
function example(){
 if (window.event.keyCode == 71)
Gkey = true;
 else if (window.event.keyCode == 76 && Gkey == true)
Lkey = true;
 else if (window.event.keyCode == 67 && Gkey == true && Lkey == true)
Ckey = true;
 else
{
Gkey = false;
Lkey = false;
Ckey = false;
}
if (Gkey && Lkey && Ckey) {
msg.innerHTML = '<marquee>Gu Laicheng 向您问好!</marquee>';
Gkey = false;
Lkey = false;
Ckey = false;
} else
{
msg.innerText = '';
}
}
document.onkeydown=example;
</script>
<body>
依次按下G L C键,会有惊喜出现!<br/>
<span id=msg style="color:#FF0000"></span><br/>
<input type=button onclick="location.reload();" value="重来">
</body>
</html>

解决方案 »

  1.   

    lz我这里怎么不能运行啊,ff3.5
      

  2.   

    好了,支持ff了<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head>
    <script>
    var Gkey=false,Lkey=false,Ckey=false;
    function example(e){
    e =window.event ||e;
    var key=e.keyCode || e.which;
    if (key== 71)
    Gkey = true;
    else if (key == 76 && Gkey == true)
    Lkey = true;
    else if (key == 67 && Gkey == true && Lkey == true)
    Ckey = true;
    else
    {
    Gkey = false;
    Lkey = false;
    Ckey = false;
    }
    if (Gkey && Lkey && Ckey) {
    msg.innerHTML = ' <marquee>Gu Laicheng 向您问好! </marquee>';
    Gkey = false;
    Lkey = false;
    Ckey = false;
    } else
    {
    msg.innerText = '';
    }
    }
    document.onkeydown=example;
    </script>
    <body>
    依次按下G L C键,会有惊喜出现! <br/>
    <span id=msg style="color:#FF0000"> </span> <br/>
    <input type=button onclick="location.reload();" value="重来">
    </body>
    </html>
      

  3.   


    // 山寨版 问候 输入Click
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head>
    <script>
    var k = [];
    document.onkeydown = function(e){
    e = e || window.event;
    k.push(e.keyCode || e.which);
    if(k.toString().indexOf('67,76,73,67,75') != -1){
    document.getElementById('msg').innerHTML = ' <marquee>Click_Me 向您问好! </marquee>';
    }
    }
    </script>
    <body>
    依次按下Click键,会有惊喜出现! <br/>
    <span id='msg' style="color:#FF0000"> </span> <br/>
    <input type='button' onclick="location.reload();" value="重来">
    </body>
    </html>
      

  4.   


    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head>
    <script>
    // 山寨版 问候 输入Click
    var k = [];
    document.onkeydown = function(e){
    e = e || window.event;
    k.push(e.keyCode || e.which);
    if(k.toString().indexOf('67,76,73,67,75') != -1){
    document.getElementById('msg').innerHTML = ' <marquee>Click_Me 向您问好! </marquee>';
    }
    }
    </script>
    <body>
    依次按下Click键,会有惊喜出现! <br/>
    <span id='msg' style="color:#FF0000"> </span> <br/>
    <input type='button' onclick="location.reload();" value="重来">
    </body>
    </html>
      

  5.   

    稍作改进...
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head>
    <script>
    // 山寨版 问候 输入Click
    var k = [];
    document.onkeydown = function(e){
        e = e || window.event;
        k.push(e.keyCode || e.which);
        if(k.toString().indexOf('67,76,73,67,75') != -1){
            document.getElementById('msg').innerHTML = ' <marquee>Click_Me 向您问好! </marquee>';
      k=[];
       } else
    {
            document.getElementById('msg').innerText = '';
    }
    }
    </script>
    <body>
    依次按下Click键,会有惊喜出现! <br/>
    <span id='msg' style="color:#FF0000"> </span> <br/>
    <input type='button' onclick="location.reload();" value="重来">
    </body>
    </html>
      

  6.   

    来个直观的。
    <html>
    <head>
    <title>趣味javascript </title>
    </head>
    <script>
    var k = { key: "ZSWANG", index: 0 };
    document.onkeydown = function(e){
    e = e || window.event;
    if (k.key.substr(k.index, 1) == String.fromCharCode(e.keyCode || e.which)) {
    if (++k.index >= k.key.length) {
    document.getElementById('msg').innerHTML += '<marquee>Zswang 向您问好! </marquee>';
    k.index = 0;
    }
    } else k.index = 0;
    }
    </script>
    <body>
    依次按下zswang键,会有惊喜出现! <br/>
    <span id='msg' style="color:#FF0000"> </span> <br/>
    </body>
    </html>
      

  7.   

    按下在CTRL键(不要抬起),再依次按下G L C键,会有惊喜出现! <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head><script>
    var Gkey=false,Lkey=false,Ckey=false;
    function example(e){
    e =window.event ||e;
    var key=e.keyCode || e.which;
    if (e.ctrlKey && key== 71)
    Gkey = true;
    else if (e.ctrlKey && key == 76 && Gkey == true)
    {
    Lkey = true;
    e.returnValue = false;
    } else if (e.ctrlKey && key == 67 && Gkey == true && Lkey == true)
    Ckey = true;
    else
    {
    Gkey = false;
    Lkey = false;
    Ckey = false;
    }
    if (Gkey && Lkey && Ckey) {
    msg.innerHTML = ' <marquee>Gu Laicheng 向您问好! </marquee>';
    Gkey = false;
    Lkey = false;
    Ckey = false;
    } else
    {
    msg.innerText = '';
    }
    }
    document.onkeydown=example;
    </script>
    <body>
    按下在CTRL键(不要抬起),再依次按下G L C键,会有惊喜出现! <br/>
    <span id=msg style="color:#FF0000"> </span> <br/>
    <input type=button onclick="location.reload();" value="重来">
    </body>
    </html>
      

  8.   

    同时按下G L C键(注意,要按次序!),会有惊喜出现!
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <title>趣味javascript </title>
    </head>
    <body>
    同时按下G L C键(注意,要按次序!),会有惊喜出现! <br/>
    <span id=msg style="color:#FF0000;font-size:30;"> </span> <br/>
    </body><script>
    var i = 0;document.onkeypress = function (e){
    if (i==3) return;
    e =window.event ||e;
    var key=e.keyCode || e.which;
    if (key == 103)
    i=1;
    else if (i==1 && key == 108)
    i=2;
    else if (i==2 && key == 99)
    i=3;
    else
    i=0;
    if (i==3)
    {
    msg.innerHTML = ' <marquee>Gu Laicheng 向您问好! </marquee>';
    } else
    {
    msg.innerText = '';
    }
    }document.onkeyup = function(e)
    {
    e =window.event ||e;
    var key=e.keyCode || e.which;
    msg.innerText = '';
    i=0;
    }
    </script>
    </html>