`
chenge2k
  • 浏览: 6948 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论

javascript是什么

    博客分类:
  • js
阅读更多
原文p2pu:http://new.p2pu.org/en/groups/javascript-101/content/week1/

js是能被浏览器理解的代码。

你可以在浏览器地址栏输入

     javascript: alert("Hi, I'm a program.");

然后回车,祝贺你,已经运行了一个js程序。

Now hop over to http://goo.gl/wYwXx and paste

     alert("Hi, I'm a program.");

into the left hand window and press preview (the emulation runs the code) and you see the same result as previously.

Now make a copy of the html in the right window and save it to a html file on your own computer, use it as a template for testing, assignments and so on.

So how and where in your html template do you put the javascript? Like other things that go in Html pages Javascript has its own set of opening/closing tags and the code goes between them like this:

<script type="text/javascript">  alert("Hi, I'm a program.");  </script>
and then very often (not always) the above is inserted between the head tags on the page. Try it now, paste the above anywhere between the head tags in a copy of your template and open it in your browser.

However the best way is to put the javascript code in its own file so make up a file with extension .js and put the code in there and store the file in the same folder as your template, then in your template file make a call to that file like this:

<script type="text/javascript" src="yourfile.js"> </script> 
Now if you open the file in the browser, the code gets executed just as previously. This is the same way that third party libraries such as JQuery get called. ( Don't worry right now if you don't know what a library or JQuery is ). Notice that this is also what is happening in JS Bin, the code is being executed as if it were in a separate file.

The program consists of a statement which is a call to the function that is the value of the property named alert of the global object. If this doesn't make too much sense to you right now, all will become clear later on.

Next listen to Douglas Crockford's video at http://yui.zenfs.com/theater/crockford-tjpl-1.m4v

Now do the javascript presentation and assignment at http://bit.ly/eANeSx (those of you feeling a bit rusty on html or css should have a look at those presentations as well).

Start working your way through the List of Examples Online for sections 1.1 thru 2.5 . (Alternate link http://umust.be/js101/index.html). You should have some familiarity with all these lessons as soon as you possibly can.
[[--- Javascript, managed by the Mozilla Foundation, as of 27 July 2010 in version 1.8.5, is an implementation (dialect) of ECMA-262 Edition 5 (aka ECMAScript5) of 3 December 2009; support for this version exists in FF4, IE9, Safari5 and Chrome10. Older browsers would have support for Edition 3.

Although not strictly correct, most people when using the word "javascript" mean any implementation in browsers, not only that of Mozilla Foundation; in fact, Javascript is now an Oracle trademark.

http://kangax.github.com/es5-compat-table/
http://kangax.github.com/es5-compat-table/non-standard/---]]

Then put up a page on your site with answers to the following and any other thoughts you might have had up to now:-


When parsing a String into a number using the parseInt() method, we are advised to always provide the radix. Why is this?
Why do we lose precision when performing operations with decimal numbers in Javascript? Can you think of a few implications of why this would be a problem?
Do you understand why the next operation produces the given result 115 * 4 - 4 + 88 / 2 = 500?
What is a type, and why do you think types are useful in writing programs?
What does typeof(4.5); do, and why does typeof(typeof(4.5)); return "string" ?
"+" in Javascript is overloaded, what does this mean?
You might be interested in how your peers commented on this and other matters in the previous incarnation of this course, here http://bit.ly/hic9F4.



http://goo.gl/saHWg     Web development - twenty six concepts or technologies.

http://goo.gl/xVu6Y     Beginner best practices.

http://goo.gl/lztxB       Javascript Primitive Types

http://goo.gl/t6teZ     Javascript Composite Types

http://goo.gl/DTsJc    Another Intro
分享到:
评论

相关推荐

    sa-sdk-javascript, 传感器分析 JavaScript SDK.zip

    sa-sdk-javascript, 传感器分析 JavaScript SDK sa-sdk-javascript传感器分析 JavaScript SDK紧急招聘前端工程师,运维工程师,大数据工程师等,各种级别的都需要,求发送到我邮箱( shengyonggen@sensorsdata.cn

    JavaScript 是什么意思

    javascript一种由Netscape的LiveScript发展而来的脚本语言,它提高与Java的兼容性。JavaScript采用HTML页作为其接口。很多朋友问js是什么意思?下面小编通过分享本教程给大家解答下,感兴趣的朋友参考下

    JavaScript基础知识简介

    本文讲了Java与JavaScript的区别。主要讲的是JavaScript的基础知识,包括JavaScript是什么,JavaScript的基本语法以及本文运用用大量的实例来讲解各种语法。

    head first JavaScript源码

    《Head First JavaScript源码》是2010年出版的一本中文版JavaScript学习书籍的源码,这本书以其独特的视觉设计和易理解的方式深入浅出地介绍了JavaScript编程语言。JavaScript是一种广泛应用于网页和网络应用的脚本...

    Simply JavaScript, JavaScript Beginning

    JavaScript,作为一种广泛应用于Web开发的脚本语言,已经成为现代网页和应用程序的核心技术。"Simply JavaScript" 和 "Beginning JavaScript with DOM Scripting and Ajax, 2nd Edition" 这两本书为初学者提供了深入...

    JavaScript标准参考教程

    在学习JavaScript之前,我们首先应该了解为什么需要学习这门语言。JavaScript之所以受欢迎,主要是因为它能够操控浏览器,具备广泛的使用场景,并且学习起来相对容易。JavaScript的性能强大,它是一种开放的语言,...

    JavaScript语言精粹完整版

    《JavaScript语言精粹》作为一本深入浅出讲解JavaScript编程语言的经典之作,对于想要提升自己JavaScript技能的开发者来说,无疑是一份宝贵的资源。本书由Douglas Crockford所著,他不仅是JSON格式的创始人,也是...

    深入理解JavaScript系列

    本书是一本全面、深入介绍JavaScript语言的学习指南。本书共分四个部分,第1部分帮助读者快速入手,掌握基本的JavaScript编程要点;第2部分介绍JavaScript的发展和技术背景;第3部分深入探索JavaScript,介绍了语法...

    JavaScript文档

    本资源包包含了多个关于JavaScript的重要参考资料,包括“JavaScript权威指南(英文版).chm”、“javascript5.5.chm”、“css2gb.chm”以及“JavaScript对象与数组参考大全 .chm”。 首先,我们来看“JavaScript权威...

    JavaScript权威指南(JavaScript犀牛书一本)

    《JavaScript权威指南》是JavaScript编程领域的一本经典之作,由著名技术作家David Flanagan撰写,被誉为"JavaScript犀牛书"。这本书深入浅出地讲解了JavaScript语言的核心概念、语法特性和高级特性,对于想要全面...

    VS2015安装证书,JavaScript_ProjectSystem.msi,JavaScript_LanguageService.msi

    在这个场景中,我们关注的是VS2015的安装过程中涉及到的证书问题以及两个特定的组件:JavaScript_ProjectSystem.msi和JavaScript_LanguageService.msi。 首先,关于“VS2015安装证书”,这通常是指安装过程中需要...

    JavaScript全栈教程 (廖雪峰) 完整版PDF

    简单地说,JavaScript是一种运行在浏览器中的解释型的编程语言。在Web世界里,只有JavaScript能跨平台、跨浏览器驱动网 页,与用户交互。 《JavaScript全栈教程》是小白的零基础JavaScript全栈教程。从基础入门在...

    JavaScript学习指南 高清 PDF

    JavaScript,一种广泛应用于Web开发的脚本语言,是前端开发的核心技术之一。这份"JavaScript学习指南"高清PDF,无疑为想要深入理解JavaScript的初学者或有一定基础的开发者提供了宝贵的资源。下面,我们将深入探讨...

    javascript教案 JavaScript基础

    1.2 什么是JavaScript 4 1.3 JavaScript的特点 4 1.3.1 javascript的优点 5 1.3.2 javascript的局限性 5 1.4 Java 与 JavaScript 有什么不同 5 第二章 语法基础 7 2.1 在什么地方插入 JavaScript 7 ...

    JavaScript基础语法(ppt)

    JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)JavaScript基础语法(ppt)...

    JavaScript权威指南第五版(JavaScript_The_Definitive_Guide_5th.chm)

    本书还包括详细的参考手册,涵盖了JavaScript的核心 API、遗留的客户端API和W3C标准DOM API,记述了这些API中的每一个JavaScript对象、方法、性质、构造函数、常量和事件处理程序。  这本最畅销的JavaScript参考书...

    head first javascript 中文版.pdf

    JavaScript是一种广泛应用于Web开发的脚本语言,它主要在客户端运行,为网页添加交互性,使得用户能够与页面进行动态沟通。"Head First JavaScript"是一本面向初学者的优秀教材,旨在通过直观、易懂的方式教授...

    现代JavaScript教程

    现代JavaScript教程是一个全面的学习资源,旨在帮助开发者深入理解JavaScript这一重要的编程语言。JavaScript,作为Web开发的核心技术之一,被广泛用于构建交互式的网页和应用程序。本教程覆盖了从基础概念到高级...

    Free JavaScript Editor 4.7 javascript编辑器 天涯浪子

    Free JavaScript Editor编辑器是一个先进的Java脚本编辑器,验证器和调试器对于初学者和专家。 免费的JavaScript编辑器是用于专业编辑JavaScript代码和创建动画和其他特殊效果网页使用DOM中,使用DOM, DHTML, CSS, ...

Global site tag (gtag.js) - Google Analytics