我想把下面的函数按“abc”执行“alert("hello world!")”,请问怎么做?
按键代码如下:
a:97 b:98 c:99
<body>
<script type="text/javascript" src="http://localhost/leb/auto/js/jquery-latest.js"></script>
<script>
window.onload= function(){
$(document).keypress(function(e){
if (e.which==97){
alert("hello world!"); //如果按a,就弹出hello world
}
})
}
</script>
<div id="test">1111</div>
</body>
按键代码如下:
a:97 b:98 c:99
<body>
<script type="text/javascript" src="http://localhost/leb/auto/js/jquery-latest.js"></script>
<script>
window.onload= function(){
$(document).keypress(function(e){
if (e.which==97){
alert("hello world!"); //如果按a,就弹出hello world
}
})
}
</script>
<div id="test">1111</div>
</body>
<script type="text/javascript" src="http://localhost/leb/auto/js/jquery-latest.js"></script> <script>
var apressed , bpressed , cpressed; window.onload= function(){
$(document).keydown(function(e){
if (e.which==65) apressed = true;
if (e.which==66) bpressed = true;
if (e.which==67) cpressed = true;
if (apressed && bpressed && cpressed){
alert("hello world!");
}
})
$(document).keyup(function(e){
apressed = bpressed = cpressed = false;
}) }
</script>
hokee哥,你的代码在firefox下测试无效,怎么回事?在fiefox下按键代码是 a:97 b:98 c:99 ,改过来也没用
javascript怎样把所有[color=#FF6600]script标签移动到body最后面?[/color]
链接:http://topic.csdn.net/u/20090802/18/ea082e0c-dc6d-4a25-ba22-9b5d78715cfb.html
貌似jquery 无法操作script标签,欲哭无泪。