Javascript学习心得

Javascript学习心得


Javascript的应用目的

通过对JavaScript的学习,知道它是由C语言演变而来的,而且在很大程度上借用了Java的语法,而Java又是由C和C++演生而来的,所以JavaScript和C有许多相似的语法特点。JavaScript的出现,可以使得信息和用户之间不仅只是一种显示和浏览的关系,而是实现了一种实时的、动态的、可交互的表达能力。从而基于CGI静态的HTML页面将被可提供动态实时信息,并对客户操作进行反应的Web页面取代。JavaScript 脚本正是满足这种需求而产生的语言。它深受广泛用户的喜爱和欢迎,它是众多脚本语言中较为优秀的一种。

Javascript的优点

JavaScript是一种基于对象和事件驱动并具有安全性能的脚本语言。使用它的目的是与HTML超文本标记语言、Java 脚本语言一起实现在一个Web页面中链接多个对象,与Web客户交互作用。从而可以开发客户端的应用程序等。它是通过嵌入或调入在标准的HTML语言中实现的。它的出现弥补了HTML语言的缺陷,它是Java与HTML折衷的选择,具有以下几个基本特点:

一、脚本编写语言
JavaScript是一种脚本语言,它采用小程序段的方式实现编程。像其它脚本语言一样,JavaScript 同样已是一种解释性语言,它提供了一个简易的开发过程。它的基本结构形式与C、C++、VB等语言十分类似。但它不像这些语言一样,需要先编译,而是在程序运行过程中被逐行地解释。它与HTML标识结合在一起,从而方便用户的使用操作。

二、基于对象的语言
JavaScript是一种基于对象的语言,同时以可以看作一种面向对象的。这意味着它能运用自己已经创建的对象。因此,许多功能可以来自于脚本环境中对象的方法与脚本的相互作用。

三、简单性
JavaScript的简单性主要体现在:首先它是一种基于Java 基本语句和控制流之上的简单而紧凑的设计, 从而对于学习Java是一种非常好的过渡。其次它的变量类型是采用弱类型,并未使用严格的数据类型。

四、安全性
JavaScript 是一种安全性语言,它不允许访问本地的硬盘,并不能将数据存入到服务器上,不允许对网络文档进行修改和删除,只能通过浏览器实现信息浏览或动态交互。从而有效地防止数据的丢失。

五、动态性
JavaScript 是动态的,它可以直接对用户或客户输入做出响应,无须经过Web 服务程序。它对用户的反映响应,是采用以事件驱动的方式进行的。所谓事件驱动,就是指在主页中执行了某种操作所产生的动作,就称为“事件”。比如按下鼠标、移动窗口、选择菜单等都可以视为事件。当事件发生后,可能会引起相应的事件响应。


六、跨平台性
JavaScript 是依赖于浏览器本身,与操作环境无关,只要能运行浏览器的计算机,并支持JavaScript的浏览器就可正确执行。

Javascript的运行步骤

根据JavaScript脚本编写的方式,脚本的执行也分为多种情况。当浏览器打开一个HTML文档时它将从头开始解释整个文档,而有一些脚本如函数function,则会在它们被调用的时候运行,脚本函数的调用往往都是通过事件来进行驱动的,如在一个HTML 文档被装载onLoad的时候可以执行脚本函数。



Javascript application goal

By learning JavaScript, know that it is evolved from the C language, but also to a large extent borrowed the syntax of Java, but Java is again C and C + + students come forward, so there are many similarities JavaScript and C Syntax features. The emergence of JavaScript, you can make the information not just between users and the relationship between a display and browsing, but rather to achieve a real-time, dynamic, interactive presentation. To static HTML pages based on CGI will be providing dynamic real-time information, and customer response operation Web page instead. JavaScript script is generated to meet this demand language. It is deeply loved and welcomed a wide range of users, it is more of many scripting languages ??good one.
Advantage of Javascript

JavaScript is an object-based and event-driven and have the security of the scripting language. Its purpose is to use Hypertext Markup Language HTML, Java scripting language implemented in a Web page with links to more than one object in, and Web customer interactions. Which can develop client applications and so on. It is embedded in or transferred through the standard HTML language to achieve. It appears to make up for the HTML language deficiencies, it is Java and HTML compromise choice, has the following characteristics:

First, the scripting language
JavaScript is a scripting language, which uses a small block in the way of programming. Like other scripting languages??, JavaScript is an interpreted language as it provides an easy development process. Its basic structure with C, C + +, VB and other languages ??are very similar. However, unlike these languages??, you need to compile, but the program is running in interpreted line by line. It identifies the combination of HTML, so as to facilitate the use of user operation.

Second, object-based language
JavaScript is an object-based language, both can be seen as an object-oriented. This means that it can use its object has been created. Therefore, many features of objects from the scripting environment interaction methods and scripts.

Third, the simplicity
JavaScript is mainly reflected in the simplicity: first, it is a Java based on basic statements and control flow simple and compact design, which for learning Java is a very good transition. Second, it is the use of weak type vari

able type, not using strict data types.

Fourth, security
JavaScript is a safe language, it does not allow access to local hard disk, does not bring the data stored on the server, the network is not allowed to modify, and delete documents, the information can only be achieved through the browser view or the dynamic interaction. Which can effectively prevent data loss.

Fifth, dynamic
JavaScript is dynamic, it can be input directly to users or customers respond to Web service without going through procedures. It reflects the user's response is to use the event-driven Manner. The so-called event-driven, meaning the home page generated by the implementation of a certain operation. The action, called "Event. " For example pressing the mouse, move the window, select the menu and so on.Can be regarded as events. When an event occurs, the event may cause a corresponding response.

Sixth, cross-platform
JavaScript is dependent on the browser itself, has nothing to do with the operating environment, as long as running

Browser's computer and browser that supports JavaScript can execute correctly.

Javascript running steps

According to the way JavaScript scripting, script execution is also divided into a number of situations. When

Browser will open a HTML document to explain the entire document from scratch, and some feet

Such as the function of this function, will be called when they run, the script calls the function.Are often to be driven by events, such as an HTML document is loaded .

When can the script function.

相关文档
最新文档