javascript是什么

原文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

你可能感兴趣的:(JavaScript,jquery,oracle,UP,yui)