- 6
- 0
- 约2.59万字
- 约 18页
- 2018-03-16 发布于湖北
- 举报
web翻译
8.1.4The Document Object Model(DOM)8.1.4文档对象模型(DOM)The alert in our previous example is probably the simplest statement that produce a visible output. But in most situations users prefer when the response to their action appears within the web page itself, such as new text on the page, altered styles of the page’s elements, or added content on the page. In order to produce effects like these, we must learn the basics of how a JavaScript program interacts with a web page’s content.之前例子中的提示可能是能产生可视的输出的最简单的声明。但是在大部分情况下用户更喜欢对他们的操作的反馈出现在当前页面中,比如说网页上新的文本,页面元素的提示风格,或者是在页面上添加新的内容。为了产生这样的效果,我们必须要学习基本的JavaScript程序是如何跟页面内容进行交互的。JavaScript has a set of objects and functions that allow us to access and modify the content of the current web page. Each tag on the page (such as a paragraph, heading, or list item) is represented as an object. This set of objects is collectively referred to as the Document Object Model, or DOM. Interacting with DOM objects in your JavaScript code allows you to dynamically manipulate the web page’s appearance on the screen. Figure 8.5 shows a piece of HTML code and a diagram of its corresponding DOM element object.JavaScript中有一些对象和功能,可以让我们获取并修改现有网页的内容。网页上的每一个标签(比如说一个段落、标题、或表单)都是以对象的方式呈现的。这些对象都正确的指向文本对象模型,或者DOM.在你的JavaScript代码中和DOM对象进行交互,能让你动态的修改这个网页的呈现在屏幕上的外观。表8.5展示了一段HTML代码和它与DOM元素对象匹配的显示结果Document Object Model (DOM)A set of JavaScript objects representing the content of the current HTML pageHTMLp Look at this octopus; img scr=”octopus.jpg” alt=”an octopus” id=”icon01” / Cute, huh//pDOM Element ObjectProperty ValuetagName “IMG”scr “octopus.jpg”alt “an octopus”id “icon01”JavaScriptvar icon = document,getElementById(“icon01”);icon.scr = “kitty.gif”;Figure 8.5 The DOM object for an HTML element表8.5HTML元素的DOM对象The Document Object Model acts as the glue between web page content and JavaScript. We will use it to create dynamic and interactive web pages.文本对象模型充当了网页与JavaScript之间的粘接剂。我们将会用它来创造动态的和交互式的网页。Accessing DOM Objects by ID通过ID访问
您可能关注的文档
- unit3.ppt 商标《世纪商务英语翻译教程》.ppt
- Unit5-Nelson-Mandela-reading璇句欢 - 副本.ppt
- Unit9 When is your birthday的ppt.ppt
- unitonereading选修10.ppt
- Unity3d-Building-ScenesParticle-Systems中英文翻译.doc
- UNIT4 January is the first month 一月是一年中的第一个月.ppt
- uooc微观经济学2016完整答案.doc
- UserManual_XCMGⅡ_FI02总账凭证录入.doc
- v LED照明闭环控制.doc
- Using the XGATE for Manchester Decoding-中文翻译.docx
最近下载
- 专题03 《声现象》压轴培优题型训练【十二大题型】(解析版)2023-2024学年八年级上册《物理》培优专题训练(人教版).docx VIP
- (正式版)DB15∕T 3202-2023 《高纬度多年冻土区公路工程地质勘察技术规范》.docx VIP
- 制茶学第五章黑茶.ppt
- 2025年山东省春季高考英语试卷试题真题(含答案) .pdf VIP
- 专题01 声现象(讲义)中考物理一轮复习(解析版).docx VIP
- 抖音新创作者规则学习考试抖音达人违规免处罚考试答案.docx VIP
- 早产临床防治指南(2024版).pptx VIP
- 马原23版 课后答案【31页】.docx VIP
- 甘肃驾照科目一题目及答案.docx VIP
- 食物与相关食物相克.doc VIP
原创力文档

文档评论(0)