diff --git a/files/zh-cn/web/api/datatransfer/dropeffect/index.md b/files/zh-cn/web/api/datatransfer/dropeffect/index.md
index a52d8e5cc7553a..00ed1de2211a32 100644
--- a/files/zh-cn/web/api/datatransfer/dropeffect/index.md
+++ b/files/zh-cn/web/api/datatransfer/dropeffect/index.md
@@ -43,10 +43,16 @@ dataTransfer.dropEffect;
```html
- Select this element, drag it to the Drop Zone and then release the selection to move the element.
+ Select this element, drag it to the Drop Zone and then release the selection
+ to move the element.
-Drop Zone
+
+ Drop Zone
+
```
### CSS
@@ -71,7 +77,12 @@ div {
```js
function dragstart_handler(ev) {
- console.log("dragStart: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed);
+ console.log(
+ "dragStart: dropEffect = " +
+ ev.dataTransfer.dropEffect +
+ " ; effectAllowed = " +
+ ev.dataTransfer.effectAllowed,
+ );
// Add this element's id to the drag payload so the drop handler will
// know which element to add to its tree
@@ -80,7 +91,12 @@ function dragstart_handler(ev) {
}
function drop_handler(ev) {
- console.log("drop: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed);
+ console.log(
+ "drop: dropEffect = " +
+ ev.dataTransfer.dropEffect +
+ " ; effectAllowed = " +
+ ev.dataTransfer.effectAllowed,
+ );
ev.preventDefault();
// Get the id of the target and add the moved element to the target's DOM
@@ -89,10 +105,15 @@ function drop_handler(ev) {
}
function dragover_handler(ev) {
- console.log("dragOver: dropEffect = " + ev.dataTransfer.dropEffect + " ; effectAllowed = " + ev.dataTransfer.effectAllowed);
+ console.log(
+ "dragOver: dropEffect = " +
+ ev.dataTransfer.dropEffect +
+ " ; effectAllowed = " +
+ ev.dataTransfer.effectAllowed,
+ );
ev.preventDefault();
// Set the dropEffect to move
- ev.dataTransfer.dropEffect = "move"
+ ev.dataTransfer.dropEffect = "move";
}
```
diff --git a/files/zh-cn/web/api/datatransfer/getdata/index.md b/files/zh-cn/web/api/datatransfer/getdata/index.md
index edfe433fba0a7b..31a6f9b5c33197 100644
--- a/files/zh-cn/web/api/datatransfer/getdata/index.md
+++ b/files/zh-cn/web/api/datatransfer/getdata/index.md
@@ -37,7 +37,9 @@ DOMString dataTransfer.getData(format);
```html
- drag me to the other box
+ drag me to the other box
```
@@ -45,11 +47,12 @@ DOMString dataTransfer.getData(format);
### CSS
```css
-#div1, #div2 {
- width:100px;
- height:50px;
- padding:10px;
- border:1px solid #aaaaaa;
+#div1,
+#div2 {
+ width: 100px;
+ height: 50px;
+ padding: 10px;
+ border: 1px solid #aaaaaa;
}
```
@@ -57,20 +60,20 @@ DOMString dataTransfer.getData(format);
```js
function allowDrop(allowdropevent) {
- allowdropevent.target.style.color = 'blue';
- allowdropevent.preventDefault();
+ allowdropevent.target.style.color = "blue";
+ allowdropevent.preventDefault();
}
function drag(dragevent) {
- dragevent.dataTransfer.setData("text", dragevent.target.id);
- dragevent.target.style.color = 'green';
+ dragevent.dataTransfer.setData("text", dragevent.target.id);
+ dragevent.target.style.color = "green";
}
function drop(dropevent) {
- dropevent.preventDefault();
- var data = dropevent.dataTransfer.getData("text");
- dropevent.target.appendChild(document.getElementById(data));
- document.getElementById("drag").style.color = 'black';
+ dropevent.preventDefault();
+ var data = dropevent.dataTransfer.getData("text");
+ dropevent.target.appendChild(document.getElementById(data));
+ document.getElementById("drag").style.color = "black";
}
```
diff --git a/files/zh-cn/web/api/datatransfer/setdata/index.md b/files/zh-cn/web/api/datatransfer/setdata/index.md
index a10b03c421ee61..9d20aba37a1682 100644
--- a/files/zh-cn/web/api/datatransfer/setdata/index.md
+++ b/files/zh-cn/web/api/datatransfer/setdata/index.md
@@ -35,69 +35,73 @@ void dataTransfer.setData(format, data);
此示例显示了使用 {{domxref("DataTransfer")}} 对象的 {{domxref("DataTransfer.getData","getData()")}}, {{domxref("DataTransfer.setData","setData()")}} }和{{domxref("DataTransfer.clearData","clearData()")}} 方法。
```html
-
+
-
-
+
+
DataTransfer.setData()/.getData()/.clearData()
-
-
+
+
-
- DataTransfer.setData()
- DataTransfer.getData()
- DataTransfer.clearData()
-
-
-
- Select this element, drag it to the Drop Zone and then release the selection to move the element.
-
-
-
- Drop Zone
-
+
+ DataTransfer.setData()
+ DataTransfer.getData()
+ DataTransfer.clearData()
+
+
+
+ Select this element, drag it to the Drop Zone and then release the
+ selection to move the element.
+
+
+
+ Drop Zone
+
-
+
```
diff --git a/files/zh-cn/web/api/datatransfer/types/index.md b/files/zh-cn/web/api/datatransfer/types/index.md
index 1c17a7248e653d..cd7ff0cecdad87 100644
--- a/files/zh-cn/web/api/datatransfer/types/index.md
+++ b/files/zh-cn/web/api/datatransfer/types/index.md
@@ -24,10 +24,10 @@ dataTransfer.types;
这个例子展示 `types` 和 {{domxref("DataTransfer.items","items")}} 属性的用法
```html
-
+
Examples of DataTransfer.{types,items} properties
-
+