Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

translation_ajax #73

Open
wants to merge 3 commits into
base: translate
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions 04-data-visualization/json-apis-and-ajax.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,21 @@
"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 <code>DOMContentLoaded</code>. Here's the code that does this:",
"你希望代码仅在页面完成加载后执行。为此,你可将名为<code>DOMContentLoaded</code>的 JavaScript 事件附加到文档中。如例:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如例???

"<blockquote>document.addEventListener('DOMContentLoaded',function() {<br><br>});</blockquote>",
"You can implement event handlers that go inside of the <code>DOMContentLoaded</code> function. You can implement an <code>onclick</code> event handler which triggers when the user clicks on the element with id <code>getMessage</code>, by adding the following code:",
"你可以执行在<code>DOMContentLoaded</code>函数内部的事件处理程序。添加<code>onclick</code>事件处理器,当用户点击 id <code>getMessage</code>的元素时会触发事件。添加以下代码:",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

语句不通

"<blockquote>document.getElementById('getMessage').onclick=function(){};</blockquote>",
"<hr>",
"Add a click event handler inside of the <code>DOMContentLoaded</code> function for the element with id of <code>getMessage</code>."
"<code>DOMContentLoaded</code>函数内为 id <code>getMessage</code>的元素添加一个 click 事件处理器。"
],
"tests": [
{
"text": "Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.",
"testString": "assert(code.match(/document\\.getElementById\\(\\s*?('|\")getMessage\\1\\s*?\\)/g), 'Your code should use the <code>document.getElementById</code> method to select the <code>getMessage</code> element.');"
"text": "你的代码应该用<code>document.getElementById</code>方法来选择<code>getMessage</code>元素。",
"testString": "assert(code.match(/document\\.getElementById\\(\\s*?('|\")getMessage\\1\\s*?\\)/g), '你的代码应该用<code>document.getElementById</code>方法来选择<code>getMessage</code>元素。');"
},
{
"text": "Your code should add an <code>onclick</code> event handler.",
"testString": "assert(typeof document.getElementById('getMessage').onclick === 'function', 'Your code should add an <code>onclick</code> event handler.');"
"text": "你的代码应该添加<code>onclick</code>事件处理器。",
"testString": "assert(typeof document.getElementById('getMessage').onclick === 'function', '你的代码应该添加<code>onclick</code>事件处理器。');"
}
],
"solutions": [],
Expand All @@ -42,10 +42,10 @@
"contents": [
"<script>",
" document.addEventListener('DOMContentLoaded',function(){",
" // Add your code below this line",
" // 在该行下添加代码",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

在该行下添加代码 => 在这行下面添加代码

" ",
" ",
" // Add your code above this line",
" // 在该行上添加代码",
" });",
"</script>",
"<style>",
Expand Down