onkeyup 事件會(huì)在鍵盤(pán)按鍵被松開(kāi)時(shí)發(fā)生。
onkeyup="SomeJavaScriptCode"
參數(shù) | 描述 |
---|---|
SomeJavaScriptCode | 必需。規(guī)定該事件發(fā)生時(shí)執(zhí)行的 JavaScript。 |
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>, <body>,<button>, <caption>, <cite>, <code>, <dd>, <del>, <dfn>, <div>, <dt>, <em>,<fieldset>, <form>, <h1> to <h6>, <hr>, <i>, <input>, <kbd>, <label>, <legend>,<li>, <map>, <object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>,<span>, <strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>,<th>, <thead>, <tr>, <tt>, <ul>, <var>
document, image, link, textarea
當(dāng)您在例子中的輸入域中鍵入字符時(shí),字符會(huì)被更改為大寫(xiě)(逐一地):
<html><head><script type="text/javascript">function upperCase(x){var y=document.getElementById(x).valuedocument.getElementById(x).value=y.toUpperCase()}</script></head><body>輸入您的姓名: <input type="text" id="fname" onkeyup="upperCase(this.id)"
/></body></html>
輸入您的姓名:
聯(lián)系客服