JavaScript 浜嬩欢
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript 浜嬩欢相关的知识,希望对你有一定的参考价值。
鏍囩锛?a href='http://www.mamicode.com/so/1/demo' title='demo'>demo
title 绛夌瓑 inner 楠岃瘉 瑙﹀彂浜嬩欢 鐜板湪 utf-8 浠g爜HTML 浜嬩欢鏄彂鐢熷湪 HTML 鍏冪礌涓婄殑浜嬫儏銆?褰撳湪 HTML 椤甸潰涓娇鐢?JavaScript 鏃讹紝 JavaScript 鍙互瑙﹀彂杩欎簺浜嬩欢銆?/span>
HTML 浜嬩欢
HTML 浜嬩欢鍙互鏄祻瑙堝櫒琛屼负锛屼篃鍙互鏄敤鎴疯涓恒€?浠ヤ笅鏄?HTML 浜嬩欢鐨勫疄渚嬶細
HTML 椤甸潰瀹屾垚鍔犺浇
HTML input 瀛楁鏀瑰彉鏃? HTML 鎸夐挳琚偣鍑?閫氬父锛屽綋浜嬩欢鍙戠敓鏃讹紝浣犲彲浠ュ仛浜涗簨鎯呫€?鍦ㄤ簨浠惰Е鍙戞椂 JavaScript 鍙互鎵ц涓€浜涗唬鐮併€?HTML 鍏冪礌涓彲浠ユ坊鍔犱簨浠跺睘鎬э紝浣跨敤 JavaScript 浠g爜鏉ユ坊鍔?HTML 鍏冪礌銆?/span>
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>鑿滈笩鏁欑▼(runoob.com)</title> </head> <body> <button onclick="getElementById(鈥榙emo鈥?.innerHTML=Date()">鐜板湪鐨勬椂闂存槸?</button> <p id="demo"></p> </body> </html>
浠ヤ笂瀹炰緥涓紝javascript 浠g爜灏嗕慨鏀?id="demo" 鍏冪礌鐨勫唴瀹广€?鍦ㄤ笅涓€涓疄渚嬩腑锛屼唬鐮佸皢淇敼鑷韩鍏冪礌鐨勫唴瀹?(浣跨敤 this.innerHTML): <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>鑿滈笩鏁欑▼(runoob.com)</title> </head> <body> <button onclick="this.innerHTML=Date()">鐜板湪鐨勬椂闂存槸?</button> </body> </html>
JavaScript浠g爜閫氬父鏄嚑琛屼唬鐮併€傛瘮杈冨父瑙佺殑鏄€氳繃浜嬩欢灞炴€ф潵璋冪敤锛?<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>鑿滈笩鏁欑▼(runoob.com)</title> </head> <body> <p>鐐瑰嚮鎸夐挳鎵ц <em>displayDate()</em> 鍑芥暟.</p> <button onclick="displayDate()">鐐硅繖閲?lt;/button> <script> function displayDate(){ document.getElementById("demo").innerHTML=Date(); } </script> <p id="demo"></p> </body> </html>
涓嬮潰鏄竴浜涘父瑙佺殑HTML浜嬩欢鐨勫垪琛?
onchange HTML 鍏冪礌鏀瑰彉
onclick 鐢ㄦ埛鐐瑰嚮 HTML 鍏冪礌
onmouseover 鐢ㄦ埛鍦ㄤ竴涓狧TML鍏冪礌涓婄Щ鍔ㄩ紶鏍? onmouseout 鐢ㄦ埛浠庝竴涓狧TML鍏冪礌涓婄Щ寮€榧犳爣
onkeydown 鐢ㄦ埛鎸変笅閿洏鎸夐敭
onload 娴忚鍣ㄥ凡瀹屾垚椤甸潰鐨勫姞杞?
JavaScript 鍙互鍋氫粈涔?/span>?
浜嬩欢鍙互鐢ㄤ簬澶勭悊琛ㄥ崟楠岃瘉锛岀敤鎴疯緭鍏ワ紝鐢ㄦ埛琛屼负鍙婃祻瑙堝櫒鍔ㄤ綔:
椤甸潰鍔犺浇鏃惰Е鍙戜簨浠? 椤甸潰鍏抽棴鏃惰Е鍙戜簨浠? 鐢ㄦ埛鐐瑰嚮鎸夐挳鎵ц鍔ㄤ綔
楠岃瘉鐢ㄦ埛杈撳叆鍐呭鐨勫悎娉曟€? 绛夌瓑 ...
鍙互浣跨敤澶氱鏂规硶鏉ユ墽琛?JavaScript 浜嬩欢浠g爜锛? HTML 浜嬩欢灞炴€у彲浠ョ洿鎺ユ墽琛?JavaScript 浠g爜
HTML 浜嬩欢灞炴€у彲浠ヨ皟鐢?JavaScript 鍑芥暟
浣犲彲浠ヤ负 HTML 鍏冪礌鎸囧畾鑷繁鐨勪簨浠跺鐞嗙▼搴? 浣犲彲浠ラ樆姝簨浠剁殑鍙戠敓銆? 绛夌瓑 ...
以上是关于JavaScript 浜嬩欢的主要内容,如果未能解决你的问题,请参考以下文章