謂的Event 對象代表事件的狀態(tài),比如事件在其中發(fā)生的元素、鍵盤按鍵的狀態(tài)、鼠標(biāo)的位置、鼠標(biāo)按鈕的狀態(tài)。
事件通常與函數(shù)結(jié)合使用,函數(shù)不會在事件發(fā)生前被執(zhí)行!
事件句柄
HTML 4.0 的新特性之一是能夠使 HTML 事件觸發(fā)瀏覽器中的行為,比如當(dāng)用戶點擊某個 HTML 元素時啟動一段 JavaScript。下面是一個屬性列表,可將之插入 HTML 標(biāo)簽以定義事件的行為。
屬性此事件發(fā)生在何時...IEFOW3Conabort圖像的加載被中斷。419Yesonblur元素失去焦點。319Yesonchange域的內(nèi)容被改變。319Yesonclick當(dāng)用戶點擊某個對象時調(diào)用的事件句柄。319Yesondblclick當(dāng)用戶雙擊某個對象時調(diào)用的事件句柄。419Yesonerror在加載文檔或圖像時發(fā)生錯誤。419Yesonfocus元素獲得焦點。319Yesonkeydown某個鍵盤按鍵被按下。31NoYesonkeypress某個鍵盤按鍵被按下并松開。319Yesonkeyup某個鍵盤按鍵被松開。319Yesonload一張頁面或一幅圖像完成加載。319Yesonmousedown鼠標(biāo)按鈕被按下。419Yesonmousemove鼠標(biāo)被移動。319Yesonmouseout鼠標(biāo)從某元素移開。419Yesonmouseover鼠標(biāo)移到某元素之上。319Yesonmouseup鼠標(biāo)按鍵被松開。419Yesonreset重置按鈕被點擊。419Yesonresize窗口或框架被重新調(diào)整大小。419Yesonselect文本被選中。319Yesonsubmit確認(rèn)按鈕被點擊。319Yesonunload用戶退出頁面。319Yes
下面就各個事件分別介紹
1、onabort 事件
當(dāng)用戶在圖像完成載入之前放棄圖像的裝載(如單擊了 stop 按鈕)時,就會調(diào)用該句柄。
<img>
image
在本例中,如果圖像的加載被中斷,則會顯示一個對話框:
<img src="image_w3default.gif"
onabort="alert('Error: Loading of the image was aborted')" />
<img src="image_w3default.gif"
onabort="alert('Error: Loading of the image was aborted')" />
在本例中,如果圖像的加載中斷,我們將調(diào)用一個函數(shù):<html>
<head>
<script type="text/javascript">
function abortImage()
{
alert('Error: Loading of the image was aborted')
}
</script>
</head>
<body>
<img src="image_w3default.gif" onabort="abortImage()" />
</body>
</html>
2、onblur 事件
返回 Event 對象參考手冊
定義和用法
onblur 事件會在對象失去焦點時發(fā)生。
語法
onblur="SomeJavaScriptCode"參數(shù) 描述
SomeJavaScriptCode 必需。規(guī)定該事件發(fā)生時執(zhí)行的 JavaScript。
支持該事件的 HTML 標(biāo)簽:
<a>, <acronym>, <address>, <area>, <b>, <bdo>, <big>, <blockquote>,
<button>, <caption>, <cite>, <dd>, <del>, <dfn>, <div>, <dl>, <dt>,
<em>, <fieldset>, <form>, <frame>, <frameset>, <h1> to <h6>, <hr>, <i>,
<iframe>, <img>, <input>, <ins>, <kbd>, <label>, <legend>, <li>,
<object>, <ol>, <p>, <pre>, <q>, <samp>, <select>, <small>, <span>,
<strong>, <sub>, <sup>, <table>, <tbody>, <td>, <textarea>, <tfoot>,
<th>, <thead>, <tr>, <tt>, <ul>, <var>
支持該事件的 JavaScript 對象:
button, checkbox, fileUpload, layer, frame, password,
radio, reset, submit, text, textarea, window
實例 1
在本例中,我們將在用戶離開輸入框時執(zhí)行 JavaScript 代碼:
<html>
<head>
<script type="text/javascript">
function upperCase()
{
var x=document.getElementById("fname").value
document.getElementById("fname").value=x.toUpperCase()
}
</script>
</head>
<body>
輸入您的姓名:
<input type="text" id="fname" onblur="upperCase()" />
</body>
</html>
3、onchange 事件
返回 Event 對象參考手冊
定義和用法
onchange 事件會在域的內(nèi)容改變時發(fā)生。
語法
onchange="SomeJavaScriptCode"參數(shù) 描述
SomeJavaScriptCode 必需。規(guī)定該事件發(fā)生時執(zhí)行的 JavaScript。
支持該事件的 HTML 標(biāo)簽:
<input type="text">, <select>, <textarea>支持該事件的 JavaScript 對象:
fileUpload, select, text, textarea實例 1
在本例中,我們將在用戶改變輸入域內(nèi)容時執(zhí)行 JavaScript 代碼:
<html>
<head>
<script type="text/javascript">
function upperCase(x)
{
var y=document.getElementById(x).value
document.getElementById(x).value=y.toUpperCase()
}
</script>
</head>
<body>
輸入您的姓名:
<input type="text" id="fname" onchange="upperCase(this.id)" />
管用什么編輯器,基本都有這個emmet插件了。會用了,用的多了還是很省力。
nav>ul>li <nav> <ul> <li></li> </ul> </nav>
div+p+bq <div></div> <p></p> <blockquote></blockquote>
div+div>p>span+em^bq <div></div> <div> <p><span></span><em></em></p> <blockquote></blockquote> </div>
有幾個^,可以向外爬幾層。當(dāng)然爬到body就爬不動了。
先算乘除后算加減,括號內(nèi)的要先算,一個道理
(div>dl>(dt+dd)*3)+footer>p <div> <dl> <dt></dt> <dd></dd> <dt></dt> <dd></dd> <dt></dt> <dd></dd> </dl> </div> <footer> <p></p> </footer>
ul>li*5 <ul> <li></li> <li></li> <li></li> <li></li> <li></li> </ul> 乘多少生成多少
相當(dāng)于js中for循環(huán)變量i.
ul>li.item$*5 <ul> <li class="item1"></li> <li class="item2"></li> <li class="item3"></li> <li class="item4"></li> <li class="item5"></li> </ul>
#header <div id="header"></div> .title <div class="title"></div> form#search.wide <form id="search" class="wide"></form> p.class1.class2.class3 <p class="class1 class2 class3"></p>
p[title="Hello world"] <p title="Hello world"></p> td[rowspan=2 colspan=3 title] <td rowspan="2" colspan="3" title=""></td> [a='value1' b="value2"] <div a="value1" b="value2"></div>
a{Click me} <a href="">Click me</a> p>{Click }+a{here}+{ to continue} <p>Click <a href="">here</a> to continue</p>
.class <div class="class"></div> em>.class <em><span class="class"></span></em> ul>.class <ul> <li class="class"></li> </ul> table>.row>.col <table> <tr class="row"> <td class="col"></td> </tr> </table>
基本是加tab鍵自動閉合的用法。
! 自動生成html5規(guī)范文檔
a <a href=""></a>
a:link <a href="http://"></a>
a:mail <a href="mailto:"></a>
abbr <abbr title=""></abbr>(鼠標(biāo)移動懸浮title標(biāo)簽)
acronym, acr <acronym title=""></acronym>(理解可同abbr)
base <base href="" />(所有鏈接規(guī)定默認(rèn)的地址)
basefont <basefont />(寫到head內(nèi),默認(rèn)顏色和字號)
br <br />
frame <frame />
hr <hr />
bdo <bdo dir=""></bdo>(可覆蓋文本方向)
bdo:r <bdo dir="rtl"></bdo>
bdo:l <bdo dir="ltr"></bdo>
col <col />
link <link rel="stylesheet" href="" />
link:css <link rel="stylesheet" href="style.css" />
link:print <link rel="stylesheet" href="print.css" media="print" />
link:favicon <link rel="shortcut icon" type="image/x-icon" href="favicon.ico" />
link:touch <link rel="apple-touch-icon" href="favicon.png" />
link:rss <link rel="alternate" type="application/rss+xml" title="RSS" href="rss.xml" />
link:atom <link rel="alternate" type="application/atom+xml" title="Atom" href="atom.xml" />
link:import, link:im<link rel="import" href="component.html" />
meta <meta />
meta:utf <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
meta:win <meta http-equiv="Content-Type" content="text/html;charset=windows-1251" />
meta:vp <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0" />
meta:compat <meta http-equiv="X-UA-Compatible" content="IE=7" />
style <style></style>
script <script></script>
script:src <script src=""></script>
img <img src="" alt="" />
img:srcset, img:s <img srcset="" src="" alt="" />
img:sizes, img:z <img sizes="" srcset="" src="" alt="" />
picture <picture></picture>
source, src <source />
source:src, src:sc <source src="" type="" />
source:srcset, src:s <source srcset="" />
iframe <iframe src="" frameborder="0"></iframe>
embed <embed src="" type="" />
object <object data="" type=""></object>
param <param name="" value="" />
map <map name=""></map>
area <area shape="" coords="" href="" alt="" />
area后可以加d,c,r,p來生成不同的形狀
form <form action=""></form>
form:get <form action="" method="get"></form>
form:post <form action="" method="post"></form>
label <label for=""></label>
input <input type="text" />
inp <input type="text" name="" id="" />
input:hidden, input:h <input type="hidden" name="" />
input:text, input:t <input type="text" name="" id="" />
input:search <input type="search" name="" id="" />
input基本是什么加類型就可以生成,如input:time,password,后面就不再列舉
select <select name="" id=""></select>
select:disabled, select:d <select name="" id="" disabled="disabled"></select>
option, opt <option value=""></option>
textarea <textarea name="" id="" cols="30" rows="10"></textarea>
marquee <marquee behavior="" direction=""></marquee>
menu:context, menu:c <menu type="context"></menu>
menu:toolbar, menu:t <menu type="toolbar"></menu>
video <video src=""></video>
audio <audio src=""></audio>
html:xml <html xmlns="http://www.w3.org/1999/xhtml"></html>
keygen <keygen />
command <command />
button:submit, btn:s <button type="submit"></button>
button:reset, btn:r <button type="reset"></button>
button:disabled, btn:d <button disabled="disabled"></button>
fieldset:disabled, fst:d <fieldset disabled="disabled"></fieldset>
bq <blockquote></blockquote>
fig <figure></figure>
figc <figcaption></figcaption>
pic <picture></picture>
ifr <iframe src="" frameborder="0"></iframe>
emb <embed src="" type="" />
obj <object data="" type=""></object>
cap <caption></caption>
colg <colgroup></colgroup>
fst, fset <fieldset></fieldset>
btn <button></button>
optg <optgroup></optgroup>
tarea <textarea name="" id="" cols="30" rows="10"></textarea>
leg <legend></legend>
sect <section></section>
art <article></article>
hdr <header></header>
ftr <footer></footer>
adr <address></address>
dlg <dialog></dialog>
str <strong></strong>
prog <progress></progress>
mn <main></main>
tem <template></template>
datag <datagrid></datagrid>
datal <datalist></datalist>
kg <keygen />
out <output></output>
det <details></details>
cmd<command />
doc
<html> <head> <meta charset="UTF-8" /> <title>Document</title> </head> <body> </body> </html>
doc4
<html> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
ri:dpr, ri:d<img srcset="" src="" alt="" />
ri:viewport, ri:v<img sizes="" srcset="" src="" alt="" />
ri:art, ri:a
<picture> <source media="(min-width: )" srcset="" /> <img src="" alt="" /> </picture>
ri:type, ri:t
<picture> <source srcset="" type="image/" /> <img src="" alt="" /> </picture>
html:4t
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
html:4s
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
html:xt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
html:xs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
html:xxs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" /> <title>Document</title> </head> <body> </body> </html>
html:5
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <title>Document</title> </head> <body> </body> </html>
ol+
<ol> <li></li> </ol>
ul+
<ul> <li></li> </ul>
dl+
<dl> <dt></dt> <dd></dd> </dl>
map+
<map name=""> <area shape="" coords="" href="" alt="" /> </map>
table+
<table> <tr> <td></td> </tr> </table>
colgroup+, colg+
<colgroup> <col /> </colgroup>
tr+
<tr> <td></td> </tr>
select+
<select name="" id=""> <option value=""></option> </select>
optgroup+, optg+
<optgroup> <option value=""></option> </optgroup>
pic+
<picture> <source srcset="" /> <img src="" alt="" /> </picture>
!!!
<!DOCTYPE html>
!!!4t
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
!!!4s
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
!!!xt
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
!!!xs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
!!!xxs
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
c
<!-- ${child} -->
cc:ie6
<!--[if lte IE 6]> ${child} <![endif]-->
cc:ie
<!--[if IE]> ${child} <![endif]-->
cc:noie
<!--[if !IE]><!--> ${child} <!--<![endif]-->
除了基本語法和html,emment還提供了css及xsl的使用。
用法也是簡寫+tab,有興趣可以參考官方的文檔
docs.emmet.io/cheat-sheet
一行代碼搭建頁面框架
div#header>ul.nav>li*5^^^div#content>h1>a^^^div#footer
HTML(HyperText Markup Language,超文本標(biāo)記語言)是用來描述網(wǎng)頁的一種語言,它不是一種編程語言,而是一種標(biāo)記語言。
HTML5是構(gòu)建Web內(nèi)容的一種語言描述方式,HTML5是互聯(lián)網(wǎng)的下一代標(biāo)準(zhǔn),是構(gòu)建以及呈現(xiàn)互聯(lián)網(wǎng)內(nèi)容的一種語言方式,被認(rèn)為是互聯(lián)網(wǎng)的核心技術(shù)之一。HTML產(chǎn)生于1990年,1997年HTML4成為互聯(lián)網(wǎng)標(biāo)準(zhǔn),并廣泛應(yīng)用于互聯(lián)網(wǎng)應(yīng)用的開發(fā)。
HTML5是Web中核心語言HTML的規(guī)范,用戶使用任何手段進(jìn)行網(wǎng)頁瀏覽時看到的內(nèi)容原本都是HTML格式的,在瀏覽器中通過一些技術(shù)處理將其轉(zhuǎn)換成為了可識別的信息,HTML5在從前HTML4.01的基礎(chǔ)上進(jìn)行了一定的改進(jìn)。
由于HTML5只是在HTML的基礎(chǔ)上進(jìn)行了新增或者廢棄一些標(biāo)簽或者特性,本文默認(rèn)均為HTML5語法,被廢棄的部分就不再提起,HTML一般用于描述網(wǎng)頁的結(jié)構(gòu),所以一些樣式和腳本方面的標(biāo)簽和屬性以及關(guān)于JavaScript部分的特性也不再提及,重點在于梳理常用標(biāo)簽體系。
現(xiàn)今瀏覽器的許多新功能都是從HTML5標(biāo)準(zhǔn)中發(fā)展而來的。目前常用的瀏覽器有IE、火狐、谷歌、Safari和Opera等等,通過對這些主流web瀏覽器的發(fā)展策略調(diào)查,發(fā)現(xiàn)它們都支持HTML5上采取了措施。
(1)IE瀏覽器
2010年3月16日,微軟MIX10技術(shù)大會上宣布其推出的IE9瀏覽器已經(jīng)支持HTML5。同時還聲稱,隨后將會更多的支持HTML新標(biāo)準(zhǔn)和CSS3新特性。
(2)FireFox瀏覽器
2010年7月,Mozilla基金會發(fā)布了即將推出的Firefox4瀏覽器的第一個早期測試版,該版本中Firefox瀏覽器中進(jìn)行了大幅改進(jìn),包括新的HTML5語法分析器,以及支持更多的HTML5語法分析器,以及支持更多的HTML5形式的控制等。從官方文檔來看,F(xiàn)irefox4對HTML5是完全級別的支持。目前,包括在線視頻,在線音頻在內(nèi)的多種應(yīng)用都已經(jīng)在版本中實現(xiàn)。
(3)Google瀏覽器
2010年2月19日,谷歌Gears項目經(jīng)理通過微博宣布,谷歌將放棄對Gears瀏覽器插件項目的支持,以重點開發(fā)HTML5項目。據(jù)費特表示,目前在谷歌看來,Gears應(yīng)用用于HTML5的諸多創(chuàng)新非常相似,并且谷歌一直積極發(fā)展HTML5項目。因此只要谷歌不斷以加強(qiáng)網(wǎng)絡(luò)標(biāo)準(zhǔn)的應(yīng)用功能為工作重點,那么為Gears增加新功能就無太大意義了。另外,Gears面臨的需求也在日益下降,這也是谷歌做出吊證的重要原因。
(4)Safari瀏覽器
2010年6月7日,蘋果在開發(fā)者發(fā)布會公布Safari5,這款瀏覽器支持10個以上的HTML5新技術(shù),包括全屏幕播放、HTML5視頻、HTML5地理位置、HTML5切片元素、HTML5的可拖動屬性、HTML5的形式驗證、HTML5的Ruby、HTML5的Ajaxl.ishi和WebSocket字幕。
(5)Opera瀏覽器
2010年5月5日,Opera軟件公司首席技術(shù)官,號稱“CSS之父”的Hakon Wium Lie認(rèn)為,HTML5和CSS3,將會是全球互聯(lián)網(wǎng)發(fā)展的未來趨勢,包括目前Opera在內(nèi)的諸多瀏覽器廠商,紛紛研發(fā)HTML5的相關(guān)產(chǎn)品,web未來屬于HTML5。
綜上所述,目前這些瀏覽器紛紛朝著HTML5的方向邁進(jìn),HTML5的時代即將來臨。
●Notepad++
●Visual Studio Code
●HBuilderX
●Dreamweaver
●Sublime Text
●Webstorm
Webstorm為本文使用的工具,請自行購買激活,也可以使用以上的免費工具,安裝步驟都較為簡單,在此省略!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
</body>
</html>
單標(biāo)簽:
<標(biāo)簽名 [屬性名=屬性值,...]>
成對標(biāo)簽:
<標(biāo)簽名 [屬性名=屬性值,...]></標(biāo)簽名>
<h1>這是一級標(biāo)題</h1>
<h2>這是二級標(biāo)題</h2>
<h3>這是三級標(biāo)題</h3>
<h4>這是四級標(biāo)題</h4>
<h5>這是五級標(biāo)題</h5>
<h6>這是六級標(biāo)題</h6>
<p>這是一個段落</p>
使用示例:
<a href="百度一下,你就知道">打開百度,你就知道!</a>
常見屬性:
屬
<img src="https://www.baidu.com/img/PCtm_d9c8750bed0b3c7d089fa7d55720d6cf.png" alt="百度LOGO">
<table border="1px" cellpadding="0px" cellspacing="0px">
<tr>
<th>表頭一</th>
<th>表頭二</th>
<th>表頭三</th>
<th>表頭四</th>
</tr>
<tr>
<td>單元格一</td>
<td>單元格二</td>
<td>單元格三</td>
<td>單元格四</td>
</tr>
</table>
無序列表:
<ul>
<li>列表項</li>
<li>列表項</li>
<li>列表項</li>
<li>列表項</li>
</ul>
有序列表:
<ol>
<li>列表項</li>
<li>列表項</li>
<li>列表項</li>
<li>列表項</li>
</ol>
自定義列表:
<dl>
<dt>+</dt><dd>列表項</dd>
<dt>+</dt><dd>列表項</dd>
<dt>+</dt><dd>列表項</dd>
</dl>
<div>具體內(nèi)容</div>
<span>具體內(nèi)容</span>
常見標(biāo)簽:
基本布局:
常見標(biāo)簽:
案例演示:
1、form、input、label演示
<form action="" method="get">
<p>
<label for="username">賬戶:</label>
<input type="text" name="username" id="username">
</p>
<p>
<label for="password">密碼:</label>
<input type="password" name="password" id="password">
</p>
<p><input type="submit"></p>
</form>
2、textarea演示
<form action="" method="post">
<textarea name="mycontext" cols="30" rows="10"></textarea>
<input type="submit">
</form>
3、fieldset、legend、select、optgroup、option演示
<form action="" method="post">
<fieldset>
<legend>請選擇你的愛好:</legend>
<select name="myhobby" id="myhobby">
<optgroup label="運動">
<option value="籃球">籃球</option>
<option value="足球">足球</option>
</optgroup>
<optgroup label="電子">
<option value="看電影">看電影</option>
<option value="看電視">看電視</option>
</optgroup>
</select>
</fieldset>
</form>
4、datalist演示
<form action="" method="post">
<input list="browsers">
<datalist id="browsers">
<option value="Internet Explorer">
<option value="Firefox">
<option value="Chrome">
<option value="Opera">
<option value="Safari">
</datalist>
</form>
5、單選框演示
<form action="" method="post">
<input type="radio" name="sex" id="male" value="male" checked>
<label for="male">Male</label>
<input type="radio" name="sex" id="female" value="female">
<label for="female">female</label>
</form>
6、復(fù)選框演示
<form action="" method="post">
<input type="checkbox" name="vehicle" id="bike" value="bike">
<label for="bike">I have a bike</label>
<input type="checkbox" name="vehicle" id="car" value="car">
<label for="car">I have a car</label>
</form>
<iframe src="百度一下,你就知道" frameborder="0" width="500px" height="500px"></iframe>
<audio controls>
<source src="horse.ogg" type="audio/ogg">
<source src="horse.mp3" type="audio/mpeg">
您的瀏覽器不支持 Audio 標(biāo)簽。
</audio>
<video width="320" height="240" controls>
<source src="movie.mp4" type="video/mp4">
<source src="movie.ogg" type="video/ogg">
您的瀏覽器不支持 Video 標(biāo)簽。
</video>
水平線:<hr>
換行:<br>
<b>粗體文本</b>
<code>計算機(jī)代碼</code>
<em>強(qiáng)調(diào)文本</em>
<i>斜體文本</i>
<kbd>鍵盤輸入</kbd>
<pre>預(yù)格式化文本</pre>
<small>更小的文本</small>
<strong>重要的文本</strong>
<abbr>縮寫詞或者首字母縮略詞</abbr>
<address>聯(lián)系信息</address>
<bdo>文字方向</bdo>
<blockquote>從另一個源引用的部分</blockquote>
<cite>工作的名稱</cite>
<del>刪除的文本</del>
<ins>插入的文本</ins>
<sub>下標(biāo)文本</sub>
<sup>上標(biāo)文本</sup>
HTML標(biāo)簽可以設(shè)置屬性,屬性總是以名稱/值對的形式出現(xiàn),比如:name=“value”,它的主要作用是控制或修飾標(biāo)簽。
HTML事件可以觸發(fā)瀏覽器中的行為,比方說當(dāng)用戶點擊某個 HTML 元素時啟動一段 JavaScript。
由窗口觸發(fā)該事件 (同樣適用于 <body> 標(biāo)簽):
表單事件在HTML表單中觸發(fā) (適用于所有 HTML 元素,但該HTML元素需在form表單內(nèi)):
通過鍵盤觸發(fā)事件,類似用戶的行為:
通過鼠標(biāo)觸發(fā)事件,類似用戶的行為:
通過視頻(videos),圖像(images)或音頻(audio) 觸發(fā)該事件,多應(yīng)用于HTML媒體元素比如:<embed>,<object>,<img>,<audio>和<video>。
課件資料?騰訊文檔
*請認(rèn)真填寫需求信息,我們會在24小時內(nèi)與您取得聯(lián)系。