【文件属性】:
文件名称:[Head.First.JavaScript].Michael.Morrison...
文件大小:12.41MB
文件格式:ZIP
更新时间:2021-05-21 02:59:10
JavaScript
下载须知:英文版,但是内容是真的清楚,超清.......
Reacting to the Virtual World 1 Tired of thinking of the Web in terms of passive pages?
Been there, done that. They’re called books. And they’re good for reading, learning...
lots of good things. But they’re not interactive. And neither is the Web without a
little help from JavaScript. Sure, you can submit a form and maybe do a trick here
and there with some crafty HTML and CSS coding, but you’re really just playing
Weekend at Bernie’s propping up a lifeless web page. Real live interactivity requires
a bit more smarts and a little more work... but it has a much bigger payoff.
the interactive web
(Online) people have needs 2
Like talking to a brick wall... nothing happens 3
But JavaScript talks back 4
Lights, camera, interaction! 6
Use the [removed] tag to tell the browser you’re writing JavaScript 11
Your web browser can handle HTML, CSS, AND JavaScript 12
Man’s virtual best friend... needs YOUR help 15
Making iRock interactive 16
Create the iRock web page 17
Test drive 17
JavaScript events: giving the iRock a voice 18
Alerting the user with a function 19
Add the iRock greeting 20
Now let’s make the iRock really interactive 22
Interaction is TWO-way communication 23
Add a function to get the user’s name 24
Instant replay: what just happened? 27
Test drive iRock 1.0 28
table of contents
xi
Everything Has Its Place 2 In the real world, people often overlook the importance of
having a place to store all their stuff. Not so in JavaScript. You simply
don’t have the luxury of walk-in closets and three-car garages. In JavaScript, everything
has its place, and it’s your job to make sure of it. The issue is data—how to represent it,
how to store it, and how to find it once you’ve put it somewhere. As a JavaScript storage
specialist, you’ll be able to take a cluttered room of JavaScript data and impose your will
on it with a flurry of virtual labels and storage bins.
storing data
Your scripts can store data 34
Scripts think in data types 35
Constants stay the SAME, variables can CHANGE 40
Variables start out without a value 44
Initialize a variable with “=” 45
Constants are resistant to change 46
What’s in a name? 50
Legal and illegal variable and constant names 51
Variable names often use CamelCase 52
Plan the Duncan’s Donuts web page 56
A first take at the donut calculations 58
Initialize your data...or else 61
NaN is NOT a number 62
You can add more than numbers 64
parseInt() and parseFloat() convert text to a number 65
Why are extra donuts being ordered? 66
Duncan discovers donut espionage 70
Use getElementById() to grab form data 71
Validate the web form’s data 72
Strive for intuitive user input 77
【文件预览】:
[Head.First.JavaScript].Michael.Morrison....pdf