<form id="hz9zz"></form>
  • <form id="hz9zz"></form>

      <nobr id="hz9zz"></nobr>

      <form id="hz9zz"></form>

    1. 明輝手游網中心:是一個免費提供流行視頻軟件教程、在線學習分享的學習平臺!

      html中用戶(在鍵盤上)按鍵時觸發的事件屬性onkeypress

      [摘要]實例當用戶按鍵時執行一段 JavaScript:<input type="text" onkeypress="displayResult()">瀏覽器支持IEFirefoxChromeSafariOpera所有主流瀏覽器都支持 onkeypres...

      實例

      當用戶按鍵時執行一段 JavaScript:

      <input type="text" onkeypress="displayResult()">

      瀏覽器支持

      IE

      Firefox

      Chrome

      Safari

      Opera

      所有主流瀏覽器都支持 onkeypress 屬性。

      定義和用法

      onkeypress 屬性在用戶(在鍵盤上)按鍵時觸發。

      提示:相對于 onkeypress 事件的事件次序:

      onkeydown onkeypress onkeyup

      注釋:在任何瀏覽器中,onkeypress 事件不會被所有按鍵觸發(例如 ALT、CTRL、SHIFT、ESC)。

      注釋:onkeypress 屬性不適用以下元素:<base>、<bdo>、<br>、<head>、<html>、<iframe>、<meta>、<param>、<script>、<style> 或 <title>。

      HTML 4.01 與 HTML5 之間的差異

      無。

      語法

      <element onkeypress="script">

      屬性值

      描述
      scriptonkeypress 發生時運行的腳本。
      <input class="text" type="text" name="PAGE" size="60" maxlength="2" value="<%=bg.getPAGE()%>" onkeypress="if(event.keyCode<48    event.keyCode>57) event.returnValue=false;">

      報錯:

      Multiple annotations found at this line:
      - Invalid character used in text string (57) event.returnValue=false;">).
      - Syntax error on token "  ", ) expected
      - Attribute value (if(event.keyCode<48    ) not closed.
      - Undefined attribute name (event.keyCode).

      把大于57放在前面就對了。。。親試

      以上就是html中用戶(在鍵盤上)按鍵時觸發的事件屬性onkeypress的詳細內容,更多請關注php中文網其它相關文章!


      網站建設是一個廣義的術語,涵蓋了許多不同的技能和學科中所使用的生產和維護的網站。




      日韩精品一区二区三区高清