zh3.htm

来自「javascript各种效果的实例及源代码」· HTM 代码 · 共 104 行

HTM
104
字号
 <html>
<head>
<title>页面加一个“热键”脚本</title>
<style type="text/css">
<!--
body {  font-family: "宋体"; font-size: 9pt; margin-top: 0px; margin-left: 0px; margin-right: 0px}
A { COLOR: black; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: none }
 A:hover { COLOR: red; FONT-SIZE: 9pt; FONT-WEIGHT: 400; TEXT-DECORATION: underline }
a:active     { font: 9pt "宋体"; cursor: hand; color: #FF0033 }

-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<SCRIPT language="JavaScript">
<!--
var hotkey=97
var destination="zh1.htm"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
//-->


</SCRIPT>
</head>

<body bgcolor="#fef4d9" onload="begintimer()">
<br>
<br>
<center><font color=red face="隶书" size=5>给页面加一个"热键"脚本</font></center>
<br>
<center>
<table border=5 bordercolor=blue borderlight=green>
<tr><td align=center><font size=5 color=red face="Arial, Helvetica, sans-serif"><strong>下面为脚本显示区!</strong></font></td></tr>
<tr><td align=center width=300 height=70>测试:按"<font size=6 color=red><strong>a</strong></font>"回到综合类一
</td></tr>
</table></center>
<br>
<br>
<center>
<textarea name=source rows=7 cols=50 class=yk9>
脚本说明:
第一步:把如下代码加入<head>区域中
<SCRIPT language="JavaScript">
<!--
var hotkey=97
var destination="zh1.htm"
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function backhome(e){
if (document.layers){
if (e.which==hotkey)
window.location=destination
}
else if (document.all){
if (event.keyCode==hotkey)
window.location=destination
}
}
document.onkeypress=backhome
//-->


</SCRIPT>


第二步:把<body>区域改为
<body bgcolor="#fef4d9" onload="begintimer()">
</textarea>
<SCRIPT LANGUAGE="JavaScript">

<!-- hide

function goHist(a) 

{

   history.go(a);

}

//-->

</script>

<FORM METHOD="post">
<INPUT TYPE="button" VALUE="返回" onClick="goHist(-1)" style="background-color: #8000FF; color: rgb(255,255,255)">
</form>
</center>
<br>
<br>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?