diff --git a/04-data-visualization/json-apis-and-ajax.json b/04-data-visualization/json-apis-and-ajax.json
index 60ce3f5..c61538d 100644
--- a/04-data-visualization/json-apis-and-ajax.json
+++ b/04-data-visualization/json-apis-and-ajax.json
@@ -5,7 +5,8 @@
"helpRoom": "Help",
"required": [
{
- "link": "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
+ "link":
+ "https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"
}
],
"challenges": [
@@ -13,21 +14,24 @@
"id": "587d7fad367417b2b2512be1",
"title": "Handle Click Events with JavaScript using the onclick property",
"description": [
- "You want your code to execute only once your page has finished loading. For that purpose, you can attach a JavaScript event to the document called DOMContentLoaded
. Here's the code that does this:",
+ "你希望代码仅在页面完成加载后执行。为此,你可将名为DOMContentLoaded
的 JavaScript 事件附加到文档中。如例:",
"
document.addEventListener('DOMContentLoaded',function() {", - "You can implement event handlers that go inside of the
});
DOMContentLoaded
function. You can implement an onclick
event handler which triggers when the user clicks on the element with id getMessage
, by adding the following code:",
+ "你可以执行在DOMContentLoaded
函数内部的事件处理程序。添加onclick
事件处理器,当用户点击 id 为getMessage
的元素时会触发事件。添加以下代码:",
"document.getElementById('getMessage').onclick=function(){};", "
DOMContentLoaded
function for the element with id of getMessage
."
+ "在DOMContentLoaded
函数内为 id 为getMessage
的元素添加一个 click 事件处理器。"
],
"tests": [
{
- "text": "Your code should use the document.getElementById
method to select the getMessage
element.",
- "testString": "assert(code.match(/document\\.getElementById\\(\\s*?('|\")getMessage\\1\\s*?\\)/g), 'Your code should use the document.getElementById
method to select the getMessage
element.');"
+ "text":
+ "你的代码应该用document.getElementById
方法来选择getMessage
元素。",
+ "testString":
+ "assert(code.match(/document\\.getElementById\\(\\s*?('|\")getMessage\\1\\s*?\\)/g), '你的代码应该用document.getElementById
方法来选择getMessage
元素。');"
},
{
- "text": "Your code should add an onclick
event handler.",
- "testString": "assert(typeof document.getElementById('getMessage').onclick === 'function', 'Your code should add an onclick
event handler.');"
+ "text": "你的代码应该添加onclick
事件处理器。",
+ "testString":
+ "assert(typeof document.getElementById('getMessage').onclick === 'function', '你的代码应该添加onclick
事件处理器。');"
}
],
"solutions": [],
@@ -42,10 +46,10 @@
"contents": [
"",
"