国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發(fā) > JS > 正文

javascript下用鍵盤控制層的移動(dòng)的代碼

2024-09-06 12:42:35
字體:
供稿:網(wǎng)友
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>鍵盤控制層的移動(dòng)</title>
<style type="text/css">
<!--
#Div {
position:absolute;
width:238px;
height:135px;
left:expression((body.clientWidth - this.offsetWidth)/2);
top:expression((body.clientHeight - this.offsetHeight)/2);
z-index:1;
text-align:center;
background:#AFDBFF;
border:#006699 1px solid;
}
#Txt{
font-size:9pt;
position:absolute;
width:200px;
top:expression((Div.offsetHeight - this.offsetHeight)/2);
left:expression((Div.offsetWidth - this.offsetWidth)/2);
}
#Txt p{
font-size:9pt;
margin:8px;
}
#Txt font{
color:#FF0000;
font-size:9pt;
}
#Layer1 {
border:#006699 1px solid;
padding:10px;
font-size:9pt;
color:#336699;
position:absolute;
top:expression((body.clientHeight - this.offsetHeight)/2);
left:expression((body.clientWidth - this.offsetWidth)/2 + Div.offsetWidth);
}
#Layer1 Input {
font-size:9pt;
color:#336699;
}
#Int {
text-align:right;
}
-->
</style>
</head>
<body>
<div id="Div"><span id="Txt"><p>請分別按下 <font>↑</font>、<font>↓</font>、<font>←</font>、<font>→</font>,</p><p>
試試看有什么效果? </p></span></div>
<span id="Layer1">控制鍵設(shè)置:<br>
向上移動(dòng):
<input name="Up" type="text" value="↑" size="6"><br>
向下移動(dòng):
<input name="Down" type="text" value="↓" size="6"><br>
向左移動(dòng):
<input name="Left" type="text" value="←" size="6"><br>
向右移動(dòng):
<input name="Right" type="text" value="→" size="6"><br>
每次移動(dòng)  <input name="Int" type="text" id="Int" value="5" size="4" maxlength="3">
px;</span>
</body>
</html>
<script language="javascript">
<!--
//alert(txt.style.top);
var up,down,left,right;
up = 38;
down = 40;
left = 37;
right = 39;
function document.onkeydown()
{
// alert(event.keyCode);
//左:37 上:38 右:39 下:40
var int;
int = parseInt(document.getElementById("Int").value);
if(int == "NaN")
  int = 5;
var str = "",press,evet;
var div = document.getElementById("Div");
var txt = document.getElementById("Txt");
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 伊通| 佛教| 政和县| 浦江县| 岳阳市| 武平县| 望都县| 奉新县| 苗栗县| 铜陵市| 正宁县| 徐水县| 太仆寺旗| 昌都县| 高碑店市| 晋江市| 密山市| 灵寿县| 雷州市| 当涂县| 江达县| 奇台县| 临泉县| 萨嘎县| 台东市| 息烽县| 石楼县| 平定县| 望城县| 兴仁县| 龙川县| 神农架林区| 郧西县| 嘉善县| 巴东县| 乐陵市| 健康| 鹰潭市| 米林县| 长白| 城市|