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

首頁 > 編程 > JavaScript > 正文

JS模擬鍵盤打字效果的方法

2019-11-20 11:54:49
字體:
供稿:網(wǎng)友

本文實(shí)例講述了JS模擬鍵盤打字效果的方法。分享給大家供大家參考。具體如下:

這里使用JS模擬實(shí)現(xiàn)軟鍵盤及打字效果,點(diǎn)擊軟鍵盤年的字母鍵,文本框中即可顯示文字,像是鍵盤打字的效果,美工不太好,沒怎么美化,CSS高手可美化一下按鈕,看上去還挺不錯(cuò)吧,我覺得。

先來看看運(yùn)行效果圖:

具體代碼如下:

<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312"><title>模擬鍵盤打字</title></head><body><script Language="Javascript">function a(){var text=document.form.text.valuedocument.form.text.value=text + "A";}function b(){var text=document.form.text.valuedocument.form.text.value=text + "B";}function c(){var text=document.form.text.valuedocument.form.text.value=text + "C";}function d(){var text=document.form.text.valuedocument.form.text.value=text + "D";}function e(){var text=document.form.text.valuedocument.form.text.value=text + "E";}function f(){var text=document.form.text.valuedocument.form.text.value=text + "F";}function g(){var text=document.form.text.valuedocument.form.text.value=text + "G";}function h(){var text=document.form.text.valuedocument.form.text.value=text + "H";}function i(){var text=document.form.text.valuedocument.form.text.value=text + "I";}function j(){var text=document.form.text.valuedocument.form.text.value=text + "J";}function k(){var text=document.form.text.valuedocument.form.text.value=text + "K";}function l(){var text=document.form.text.valuedocument.form.text.value=text + "L";}function m(){var text=document.form.text.valuedocument.form.text.value=text + "M";}function n(){var text=document.form.text.valuedocument.form.text.value=text + "N";}function o(){var text=document.form.text.valuedocument.form.text.value=text + "O";}function p(){var text=document.form.text.valuedocument.form.text.value=text + "P";}function q(){var text=document.form.text.valuedocument.form.text.value=text + "Q";}function r(){var text=document.form.text.valuedocument.form.text.value=text + "R";}function s(){var text=document.form.text.valuedocument.form.text.value=text + "S";}function t(){var text=document.form.text.valuedocument.form.text.value=text + "T";}function u(){var text=document.form.text.valuedocument.form.text.value=text + "U";}function v(){var text=document.form.text.valuedocument.form.text.value=text + "V";}function w(){var text=document.form.text.valuedocument.form.text.value=text + "W";}function x(){var text=document.form.text.valuedocument.form.text.value=text + "X";}function y(){var text=document.form.text.valuedocument.form.text.value=text + "Y";}function z(){var text=document.form.text.valuedocument.form.text.value=text + "Z";}function space(){var text=document.form.text.valuedocument.form.text.value=text + " ";}// --></SCRIPT><form name="form">  <p align="center"><textarea name="text" rows="10" cols="50"></textarea></p>  <p align="center"><input type="button" name="B1" value=" Q " OnClick="q()"><input  type="button" name="B2" value="W" OnClick="w()"><input type="button"  name="B3" value="E" OnClick="e()"><input type="button" name="B4" value="R" OnClick="r()"><input  type="button" name="B5" value="T" OnClick="t()"><input type="button"  name="B6" value="Y" OnClick="y()"><input type="button" name="B7" value="U" OnClick="u()"><input  type="button" name="B8" value=" I " OnClick="i()"><input type="button"  name="B9" value="O" OnClick="o()"><input type="button" name="B10" value="P" OnClick="p()"></p>  <p align="center"><input type="button" name="B11" value="A" OnClick="a()"><input  type="button" name="B12" value="S" OnClick="s()"><input type="button"  name="B13" value="D" OnClick="d()"><input type="button" name="B14"  value="F" OnClick="f()"><input type="button" name="B15" value="G" OnClick="g()"><input  type="button" name="B16" value="H" OnClick="h()"><input type="button"  name="B17" value="J" OnClick="j()"><input type="button" name="B18"  value="K" OnClick="k()"><input type="button" name="B19" value="L" OnClick="l()"></p>  <p align="center"><input type="button" name="B20" value="Z" OnClick="z()"><input  type="button" name="B21" value="X" OnClick="x()"><input type="button"  name="B22" value="C" OnClick="c()"><input type="button" name="B23"  value="V" OnClick="v()"><input type="button" name="B24" value="B" OnClick="b()"><input  type="button" name="B25" value="N" OnClick="n()"><input type="button"  name="B26" value="M" OnClick="m()"></p>  <p align="center"><input type="button" name="B27"  value="" OnClick="space()"></p><INPUT TYPE="hidden" name="hidden"></form></body></html>

希望本文所述對(duì)大家的javascript程序設(shè)計(jì)有所幫助。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 昂仁县| 辰溪县| 扎赉特旗| 宜宾市| 平塘县| 新营市| 巴彦淖尔市| 威远县| 沙湾县| 江永县| 灌阳县| 舟山市| 麻城市| 越西县| 沅陵县| 工布江达县| 连平县| 会同县| 襄汾县| 皋兰县| 揭东县| 安化县| 韶山市| 务川| 余江县| 肥乡县| 金阳县| 阿合奇县| 永靖县| 阜新市| 红桥区| 吉林市| 鸡东县| 扬州市| 罗源县| 邻水| 滦南县| 湖北省| 兴国县| 南陵县| 海淀区|