Skip to content

Commit f7306c2

Browse files
committed
doc: add onbeforeprint/onbeforeunload/onblur/oncanplay document.
1 parent 0da66fe commit f7306c2

File tree

7 files changed

+290
-60
lines changed

7 files changed

+290
-60
lines changed

.idoc/.filesStat.json

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,9 +2250,9 @@
22502250
"birthtime": "2022-04-24T07:43:17.339Z"
22512251
},
22522252
"docs/tags/menu.md": {
2253-
"atime": "2022-05-14T17:50:40.465Z",
2254-
"mtime": "2022-05-14T17:50:40.466Z",
2255-
"ctime": "2022-05-14T17:50:40.466Z",
2253+
"atime": "2022-05-16T01:48:44.021Z",
2254+
"mtime": "2022-05-16T01:48:41.947Z",
2255+
"ctime": "2022-05-16T01:48:41.947Z",
22562256
"birthtime": "2022-04-30T10:33:33.935Z"
22572257
},
22582258
"docs/tags/menu_type.md": {
@@ -2400,9 +2400,9 @@
24002400
"birthtime": "2022-04-24T07:43:17.340Z"
24012401
},
24022402
"docs/tags/noframes.md": {
2403-
"atime": "2022-05-01T07:33:35.136Z",
2404-
"mtime": "2022-05-01T07:33:32.797Z",
2405-
"ctime": "2022-05-01T07:33:32.797Z",
2403+
"atime": "2022-05-16T01:48:44.366Z",
2404+
"mtime": "2022-05-16T01:48:41.985Z",
2405+
"ctime": "2022-05-16T01:48:41.985Z",
24062406
"birthtime": "2022-04-24T07:43:17.340Z"
24072407
},
24082408
"docs/tags/noscript.md": {
@@ -2754,9 +2754,9 @@
27542754
"birthtime": "2022-04-25T13:38:12.550Z"
27552755
},
27562756
"docs/tags/small.md": {
2757-
"atime": "2022-05-03T17:19:39.025Z",
2758-
"mtime": "2022-05-03T17:19:37.935Z",
2759-
"ctime": "2022-05-03T17:19:37.935Z",
2757+
"atime": "2022-05-16T01:48:43.984Z",
2758+
"mtime": "2022-05-16T01:48:41.947Z",
2759+
"ctime": "2022-05-16T01:48:41.947Z",
27602760
"birthtime": "2022-04-24T07:43:17.342Z"
27612761
},
27622762
"docs/tags/source.md": {
@@ -2820,9 +2820,9 @@
28202820
"birthtime": "2022-04-25T13:38:12.550Z"
28212821
},
28222822
"docs/tags/sub.md": {
2823-
"atime": "2022-05-01T10:00:33.728Z",
2824-
"mtime": "2022-05-01T09:51:28.102Z",
2825-
"ctime": "2022-05-01T09:51:28.102Z",
2823+
"atime": "2022-05-16T01:48:44.344Z",
2824+
"mtime": "2022-05-16T01:48:41.985Z",
2825+
"ctime": "2022-05-16T01:48:41.985Z",
28262826
"birthtime": "2022-04-24T07:43:17.342Z"
28272827
},
28282828
"docs/tags/style_type.md": {
@@ -2838,9 +2838,9 @@
28382838
"birthtime": "2022-04-24T07:43:17.342Z"
28392839
},
28402840
"docs/tags/svg.md": {
2841-
"atime": "2022-05-01T10:00:50.730Z",
2842-
"mtime": "2022-05-01T10:00:37.207Z",
2843-
"ctime": "2022-05-01T10:00:37.207Z",
2841+
"atime": "2022-05-16T01:48:43.993Z",
2842+
"mtime": "2022-05-16T01:48:41.897Z",
2843+
"ctime": "2022-05-16T01:48:41.897Z",
28442844
"birthtime": "2022-04-24T07:43:17.342Z"
28452845
},
28462846
"docs/tags/sup.md": {
@@ -2880,9 +2880,9 @@
28802880
"birthtime": "2022-04-25T13:38:12.550Z"
28812881
},
28822882
"docs/tags/template.md": {
2883-
"atime": "2022-05-14T17:52:54.607Z",
2884-
"mtime": "2022-05-14T17:52:54.571Z",
2885-
"ctime": "2022-05-14T17:52:54.571Z",
2883+
"atime": "2022-05-16T01:48:43.989Z",
2884+
"mtime": "2022-05-16T01:48:41.947Z",
2885+
"ctime": "2022-05-16T01:48:41.947Z",
28862886
"birthtime": "2022-04-24T07:43:17.343Z"
28872887
},
28882888
"docs/tags/textarea_autofocus.md": {
@@ -3042,9 +3042,9 @@
30423042
"birthtime": "2022-04-24T07:43:17.343Z"
30433043
},
30443044
"docs/tags/tr.md": {
3045-
"atime": "2022-05-01T11:55:05.778Z",
3046-
"mtime": "2022-05-01T11:53:53.960Z",
3047-
"ctime": "2022-05-01T11:53:53.960Z",
3045+
"atime": "2022-05-16T01:48:43.990Z",
3046+
"mtime": "2022-05-16T01:48:41.984Z",
3047+
"ctime": "2022-05-16T01:48:41.984Z",
30483048
"birthtime": "2022-04-24T07:43:17.343Z"
30493049
},
30503050
"docs/tags/track_label.md": {
@@ -3090,15 +3090,15 @@
30903090
"birthtime": "2022-04-24T07:43:17.343Z"
30913091
},
30923092
"docs/tags/var.md": {
3093-
"atime": "2022-05-03T17:19:39.030Z",
3094-
"mtime": "2022-05-03T17:19:37.935Z",
3095-
"ctime": "2022-05-03T17:19:37.935Z",
3093+
"atime": "2022-05-16T01:48:43.981Z",
3094+
"mtime": "2022-05-16T01:48:41.918Z",
3095+
"ctime": "2022-05-16T01:48:41.918Z",
30963096
"birthtime": "2022-04-24T07:43:17.343Z"
30973097
},
30983098
"docs/tags/video.md": {
3099-
"atime": "2022-05-03T16:22:16.449Z",
3100-
"mtime": "2022-05-16T01:48:41.174Z",
3101-
"ctime": "2022-05-16T01:48:41.174Z",
3099+
"atime": "2022-05-29T10:14:59.107Z",
3100+
"mtime": "2022-05-29T10:14:59.731Z",
3101+
"ctime": "2022-05-29T10:14:59.731Z",
31023102
"birthtime": "2022-04-24T07:43:17.343Z"
31033103
},
31043104
"docs/tags/video_autoplay.md": {
@@ -3162,9 +3162,9 @@
31623162
"birthtime": "2022-04-25T13:38:12.552Z"
31633163
},
31643164
"docs/tags/wbr.md": {
3165-
"atime": "2022-05-01T13:13:01.341Z",
3166-
"mtime": "2022-05-01T13:12:55.011Z",
3167-
"ctime": "2022-05-01T13:12:55.011Z",
3165+
"atime": "2022-05-16T01:48:44.271Z",
3166+
"mtime": "2022-05-16T01:48:41.985Z",
3167+
"ctime": "2022-05-16T01:48:41.985Z",
31683168
"birthtime": "2022-04-24T07:43:17.343Z"
31693169
},
31703170
"docs/attribute/global/class.md": {
@@ -3222,9 +3222,9 @@
32223222
"birthtime": "2022-04-24T07:17:32.209Z"
32233223
},
32243224
"docs/attribute/global/spellcheck.md": {
3225-
"atime": "2022-05-09T04:16:14.824Z",
3226-
"mtime": "2022-05-09T04:16:14.446Z",
3227-
"ctime": "2022-05-09T04:16:14.446Z",
3225+
"atime": "2022-05-16T10:46:52.068Z",
3226+
"mtime": "2022-05-16T10:48:44.160Z",
3227+
"ctime": "2022-05-16T10:48:44.160Z",
32283228
"birthtime": "2022-04-24T07:17:32.209Z"
32293229
},
32303230
"docs/attribute/global/style.md": {
@@ -3606,27 +3606,27 @@
36063606
"birthtime": "2022-04-24T09:54:54.966Z"
36073607
},
36083608
"docs/attribute/onbeforeprint.md": {
3609-
"atime": "2022-04-29T15:27:16.629Z",
3610-
"mtime": "2022-04-29T15:26:49.651Z",
3611-
"ctime": "2022-04-29T15:26:49.651Z",
3609+
"atime": "2022-05-29T09:56:41.190Z",
3610+
"mtime": "2022-05-29T09:56:41.157Z",
3611+
"ctime": "2022-05-29T09:56:41.157Z",
36123612
"birthtime": "2022-04-24T09:54:54.966Z"
36133613
},
36143614
"docs/attribute/onblur.md": {
3615-
"atime": "2022-04-29T15:27:17.106Z",
3616-
"mtime": "2022-04-29T15:26:49.653Z",
3617-
"ctime": "2022-04-29T15:26:49.653Z",
3615+
"atime": "2022-05-29T10:01:47.864Z",
3616+
"mtime": "2022-05-29T10:01:48.298Z",
3617+
"ctime": "2022-05-29T10:01:48.298Z",
36183618
"birthtime": "2022-04-24T09:54:54.966Z"
36193619
},
36203620
"docs/attribute/oncanplay.md": {
3621-
"atime": "2022-04-29T15:27:16.608Z",
3622-
"mtime": "2022-04-29T15:26:49.651Z",
3623-
"ctime": "2022-04-29T15:26:49.651Z",
3621+
"atime": "2022-05-29T10:15:13.153Z",
3622+
"mtime": "2022-05-29T10:15:27.829Z",
3623+
"ctime": "2022-05-29T10:15:27.829Z",
36243624
"birthtime": "2022-04-24T09:54:54.966Z"
36253625
},
36263626
"docs/attribute/onbeforeunload.md": {
3627-
"atime": "2022-04-29T15:27:17.309Z",
3628-
"mtime": "2022-04-29T15:26:49.794Z",
3629-
"ctime": "2022-04-29T15:26:49.794Z",
3627+
"atime": "2022-05-29T09:53:37.755Z",
3628+
"mtime": "2022-05-29T09:53:37.692Z",
3629+
"ctime": "2022-05-29T09:53:37.692Z",
36303630
"birthtime": "2022-04-24T09:54:54.966Z"
36313631
},
36323632
"docs/attribute/oncanplaythrough.md": {

docs/attribute/global/spellcheck.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ HTML `spellcheck` 属性
88
带有拼写检查的可编辑段落:
99

1010
```html idoc:preview
11-
<p contenteditable="true" spellcheck="true">这是一个段落。</p>
11+
<p contenteditable="true" spellcheck="true">这是一个段落,不检查英文单词拼写。</p>
12+
<input spellcheck="false" placeholder="不检查英文单词拼写">
13+
<input spellcheck="true" placeholder="检查英文单词拼写">
1214
```
1315

1416
## 定义和使用

docs/attribute/onbeforeprint.md

Lines changed: 50 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,52 @@
1-
onbeforeprint.md
1+
HTML onbeforeprint 属性
22
===
33

4-
欢迎您编辑 <a target="__blank" href="https://github.com/jaywcjlove/html-tutorial/blob/main/docs/attribute/onbeforeprint.md">docs/attribute/onbeforeprint.md</a> 文件,共建 HTML Tutorial 文档。
4+
## 定义和用法
5+
6+
`onbeforeprint` 属性在页面即将被打印时触发(在打印对话框出现之前)。
7+
8+
**提示:** `onbeforeprint` 属性通常与 `onafterprint` 属性一起使用。
9+
10+
## 适用于
11+
12+
`onbeforeprint` 属性是 [事件属性](../reference/eventattributes.md) 的一部分,可用于以下元素:
13+
14+
| 元素 | 事件 |
15+
| --- | --- |
16+
| [\<body>](../tags/body.md) | [onbeforeprint](../attribute/onbeforeprint.md) |
17+
<!--rehype:style=width: 100%; display: inline-table;-->
18+
19+
## 示例
20+
21+
在即将打印页面时执行 JavaScript:
22+
23+
```html idoc:preview:iframe
24+
<body onbeforeprint="myFunction()">
25+
26+
<h1>尝试打印此文档</h1>
27+
<p><b>提示:</b> 键盘快捷键,例如 Ctrl+P/Command+P 设置要打印的页面。</p>
28+
<p><b>注意:</b> Safari 和 Opera 不支持 onbeforeprint 事件。</p>
29+
30+
<script>
31+
function myFunction() {
32+
alert("You are about to print this document!");
33+
}
34+
</script>
35+
</body>
36+
```
37+
38+
## 浏览器支持
39+
40+
表中的数字指定了完全支持该事件的第一个浏览器版本。
41+
42+
| 事件属性 | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] |
43+
| --- | --- | --- | --- | --- | --- |
44+
| onbeforeprint | 63 | Yes | Yes | ❌ 不支持 | ❌ 不支持 |
45+
<!--rehype:style=width: 100%; display: inline-table;-->
46+
47+
48+
[1]: ../assets/chrome.svg
49+
[2]: ../assets/edge.svg
50+
[3]: ../assets/firefox.svg
51+
[4]: ../assets/safari.svg
52+
[5]: ../assets/opera.svg

docs/attribute/onbeforeunload.md

Lines changed: 64 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,66 @@
1-
onbeforeunload.md
1+
HTML onbeforeunload 属性
22
===
33

4-
欢迎您编辑 <a target="__blank" href="https://github.com/jaywcjlove/html-tutorial/blob/main/docs/attribute/onbeforeunload.md">docs/attribute/onbeforeunload.md</a> 文件,共建 HTML Tutorial 文档。
4+
## 定义和用法
5+
6+
`onbeforeunload` 事件在文档即将被卸载时触发。
7+
8+
此事件允许您在确认对话框中显示一条消息,以通知用户他/她是要留下还是离开当前页面。
9+
10+
确认框中显示的默认消息在不同的浏览器中有所不同。 但是,标准消息类似于“您确定要离开此页面吗?”。 您无法删除此消息。
11+
12+
但是,您可以将自定义消息与默认消息一起编写。 请参阅此页面上的第一个示例。
13+
14+
**注意:** 在 Firefox 中,只会显示默认消息(不是自定义消息(如果有))。
15+
16+
## 适用于
17+
18+
`onbeforeunload` 属性是 [Event Attributes](../attribute/onbeforeunload.md) 的一部分,可用于以下元素:
19+
20+
| 元素 | 事件 |
21+
| --- | --- |
22+
| [\<body>](../tags/body.md) | [onbeforeunload](../attribute/onbeforeunload.md) |
23+
<!--rehype:style=width: 100%; display: inline-table;-->
24+
25+
26+
[1]: ../assets/chrome.svg
27+
[2]: ../assets/edge.svg
28+
[3]: ../assets/firefox.svg
29+
[4]: ../assets/safari.svg
30+
[5]: ../assets/opera.svg
31+
32+
33+
## 示例
34+
35+
当页面即将被卸载时执行 JavaScript:
36+
37+
```html idoc:preview:iframe
38+
<body onbeforeunload="return myFunction()">
39+
<p>关闭此窗口,按 F5 或单击下面的链接以调用 onbeforeunload 事件。</p>
40+
41+
<a href="https://jaywcjlove.github.io/html-tutorial">单击此处访问 https://jaywcjlove.github.io/html-tutorial</a>
42+
43+
<script>
44+
function myFunction() {
45+
return "在这里写一些聪明的东西......";
46+
}
47+
</script>
48+
</body>
49+
```
50+
51+
## 浏览器支持
52+
53+
表中的数字指定了完全支持该事件的第一个浏览器版本。
54+
55+
| 事件属性 | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] |
56+
| --- | --- | --- | --- | --- | --- |
57+
| onbeforeunload | Yes | Yes | Yes | Yes | 15.0 |
58+
<!--rehype:style=width: 100%; display: inline-table;-->
59+
60+
61+
[1]: ../assets/chrome.svg
62+
[2]: ../assets/edge.svg
63+
[3]: ../assets/firefox.svg
64+
[4]: ../assets/safari.svg
65+
[5]: ../assets/opera.svg
66+

docs/attribute/onblur.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,49 @@
1-
onblur.md
1+
HTML onblur 属性
22
===
33

4-
欢迎您编辑 <a target="__blank" href="https://github.com/jaywcjlove/html-tutorial/blob/main/docs/attribute/onblur.md">docs/attribute/onblur.md</a> 文件,共建 HTML Tutorial 文档。
4+
## 定义和用法
5+
6+
`onblur` 属性会在元素失去焦点时触发。
7+
8+
Onblur 最常与表单验证代码一起使用(例如,当用户离开表单字段时)。
9+
10+
**提示:** `onblur` 属性与 `onfocus` 属性相反。
11+
12+
## 适用于
13+
14+
`onblur` 属性是 [事件属性](../reference/eventattributes.md) 的一部分,可用于任何 HTML 元素。
15+
16+
| 元素 | 事件 |
17+
| --- | --- |
18+
| 所有 HTML 元素 | [onblur](../attribute/onblur.md) |
19+
<!--rehype:style=width: 100%; display: inline-table;-->
20+
21+
## 示例
22+
23+
当用户离开时验证输入字段:
24+
25+
```html idoc:preview:iframe
26+
输入你的名字: <input type="text" name="fname" id="fname" onblur="myFunction()">
27+
<p>当您离开输入字段时,会触发一个函数,将输入文本转换为大写。</p>
28+
29+
<script>
30+
function myFunction() {
31+
var x = document.getElementById("fname");
32+
x.value = x.value.toUpperCase();
33+
}
34+
</script>
35+
```
36+
37+
## 浏览器支持
38+
39+
| 事件属性 | ![chrome][1] | ![edge][2] | ![firefox][3] | ![safari][4] | ![opera][5] |
40+
| --- | --- | --- | --- | --- | --- |
41+
| onblur | Yes | Yes | Yes | Yes | Yes |
42+
<!--rehype:style=width: 100%; display: inline-table;-->
43+
44+
[1]: ../assets/chrome.svg
45+
[2]: ../assets/edge.svg
46+
[3]: ../assets/firefox.svg
47+
[4]: ../assets/safari.svg
48+
[5]: ../assets/opera.svg
49+

0 commit comments

Comments
 (0)