在一个网页中使插入JavaScript
来源:wenku7.com 资料编号:WK78652 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9AWK78652
资料介绍
在一个网页中使插入 JAVAScript 如何实现... ■了解基本的 HTML 结构 ■使用 <script> 把 JAVAScript脚本语言加入一个网页 ■为不支持脚本语言的浏览器使用 <noscript>语言 ■加载一个外部的 JAVAScript 文件(毕业设计 ) ■使用超链接调用 JAVAScript脚本语言 直到以上, 我们一直专注于 JavaScript 脚本语言的规画,正如你所看到的, JAVAScript脚本语言拥有多数特征使之成为一种理想语言, 它最强壮的特征是它能整合进入各式各样环境。 JAVAScript 脚本语言的版本在很多不同的环境内存在: ■asp语言必须使用IIS服务器 ■服务器端 JAVAScript(SSJS) 为Netscape /iPlanet 的网站服务器 ■服务器端规画语言为其他的网页服务 ■一种植入的语言为 Adobe Acrobat PDF 文件 ■一种植入的语言为 Macromedia Flash 文件 (ActiveScript) 但是直到今天, 自从它被发明以来大约10年了, JavaScript 脚本语言最大的成功仍然是被当做一种嵌入网页的语言。我们现在使用的每一台浏览器都能支持它-它是安装在全世界的数以百计的数以百万计的个人计算机上的。在这一个章节, 我们将学习该如何在HTML 网页使插入 JAVAScript 脚本语言和一些基本本文格式技术。 了解基本的 HTML 结构 超文本标记语言, 或简称为HTML, 它是用来编写网页的语言。 HTML 即是一种标记语言, 因为它是使用一组预定义的标签, 或称为标记,它用来提供各种格式和对网站浏览器的指导。 举例来说吧, 下列的例子就包含一些 HTML 标记标签: <font size="2"><b>Now is the time</b> for all good men <u>to come to the aid</u> of <i>their party</i>.</font> 正如你所见,HTML 标记标签通常总是附在角度支架中。大部分的 HTML 标签有两个标记,包括一个开始标记 (加粗的本文标签,<b>,为例) 和一个结束标签(如 </b>), 但有时也有一些例外情况。 使用 <script> 把 JAVAScript 脚本语言加入一个网页 Embed JAVAScript in a Web Page How to... ■ Understand basic HTML structure ■ Use <script> to add JAVAScript to a web page ■ Use <noscript> for browsers that don’t support scripting ■ Load an external JAVAScript file ■ Call JAVAScript using hyperlinks Up until this point in the book, we have been concentrating on JavaScript’s programming syntax—the statements and definitions that are the nuts and bolts of the language. As you’ve seen, JAVAScript has many features that make it an ideal language for many tasks, and one of its strongest features is its ability to integrate into a wide variety of other environments. Versions of JAVAScript exist in many different environments: ■ An Application Server Pages (asp) language for Microsoft IIS web servers (one of several supported languages) ■ Server-Side JAVAScript (SSJS) for Netscape/iPlanet web servers ■ A server-side programming language for other web servers ■ An embedded language for Adobe Acrobat PDF documents ■ An embedded language for Macromedia Flash files (ActiveScript) But even today, almost 10 years after it was first introduced, JAVAScript’s biggest success remains as an embedded programming language for web pages. It is supported by virtually every web browser in use today—it is installed on hundreds of millions of PCs worldwide. In this chapter, we will examine how to embed JAVAScript in HTML pages and some basic text formatting techniques. Understand Basic HTML Structure Hypertext Markup Language, or HTML for short, is the language that web pages are written in. HTML is known as a markup language, because it uses a set of predefined tags, or markup, to provide formatting and other instructions to the web browser. For instance, the following example contains a number of HTML markup tags: <font size="2"><b>Now is the time</b> for all good men <u>to come to the aid</u> of <i>their party</i>.</font> As you can see, the HTML markup tags are always enclosed in angle brackets (< and >). Most HTML tags have both a starting tag (the bold text tag, <b>, for instance) and a closing tag (like </b>), although there are some exceptions to this rule. Use <script> to Add JAVAScript to a Web Page 全文4200字 |