学习 JavaScript and Ajax for the Web (Sixth Edition)
2008-03-29 20:25
627 查看
By Tom Negrino, Dori Smith |
Publisher: Peachpit Press |
Pub Date: August 28, 2006 |
Print ISBN-10: 0-321-43032-8 |
Print ISBN-13: 978-0-321-43032-8 |
Pages: 512 |
Chapter 1. Getting Acquainted with JavaScript
What JavaScript Is
JavaScript Isn't Java
Where JavaScript Came From
What JavaScript Can Do
What JavaScript Can't Do
JavaScript不允许读取或者改写客户机上的文件。
JavaScript不允许改写服务器机器上的文件。
JavaScript不能关闭不是它打开的窗口。
JavaScript不能从别的服务器上打开的网页上读取信息。
What Is Ajax?
The Snap-Together Language
Handling Events
Values and Variables
Assignments and Comparisons
Writing JavaScript-Friendly HTML
要编写现代的,符合标准的XHTML,并且使用CSS来分离文档的表现和结构。网站应该包含三种类型的文本文件:
# XHTML: 包含页面的内容和结构
# CSS: 控制页面的外观和表现
# JavaScript: 控制页面的行为
XHTML包含了两个很重要的标签:<div>和<span>。它们被用于将内容分隔为具有语义的块结构。<div>是块层次的元素,在它和其他的元素之间有物理上的分段。而<span>是inline的元素。
class和id: class标识了可以使用多次的元素,而id标识了文档中唯一的元素。
class:
.movieTitel {font: bold 14px; color: white;}
<p>We're currently showing <span class="movieTitle"> The Aviator</span> and <span class="movieTitle"> The Outlaw</span>.</p>
id:
#theaterName {font: bold 28px; color: red;}
<h1 id="theaterName">The Raven Theater Presents:</h1>
What Tools to Use?
Chapter 2. Start Me Up!
<html> <head> <script language type src> <title> <body bgcolor> <h1> <h6 aligh> <a href id> ...
Where to Put Your Scripts
About Functions
Using External Scripts
Putting Comments in Scripts
Alerting the User
Confirming a User's Choice
Prompting the User
Redirecting the User with a Link
Using JavaScript to Enhance Links
Working with Referrer Pages
Chapter 3. Language Essentials
<table> <tr> <th> <td>
Around and Around with Loops
Passing a Value to a Function
----------------------------------------
function currentScore(hometeam, visitors)
Detecting Objects
--------------------
if (document.getElementById) { }
Working with Arrays
---------------------
var newCars = new Array("Toyota", "Honda", "Nissan");
var colPlace = new Array(0,1,2,3,4, 0,1,2,3,4,0,1,3,4,0,1,2,3,4,0,1, 2,3,4);
var newNum = (colPlace[thisSquare] * 15) + Math.floor(Math.random() * 15) + 1;
Working with Functions That Return Values
---------------------------------------------
var newNum = colBasis + getNewNum() + 1;
function getNewNum() {
return Math.floor(Math.random() * 15);
}
Updating Arrays
-----------------
var usedNums = new Array(76);
usedNums[newNum] = true;
Using Do/While Loops
Calling Scripts Multiple Ways
Using Multi-level Conditionals
Handling Errors
------------------
var ans = prompt("Enter a number","");
try {
if (!ans || isNaN(ans) || ans<0) {
throw new Error("Not a valid number");
}
alert("The square root of " + ans + " is " + Math.sqrt(ans));
}
catch (errMsg) {
alert(errMsg.message);
}
相关文章推荐
- JavaScript and Ajax for the Web, Sixth Edition
- MooTools Essentials: The Official MooTools Reference for JavaScript™ and Ajax Development
- Adapting to Web Standards: CSS and Ajax for Big Sites
- Ajax Hacks : Tips & Tools for Cleaning Up the Web (Hacks)
- Get the content of an Iframe in Javascript – crossbrowser solution for both IE and Firefox
- Web Scraping Ajax and Javascript Sites
- OWIN support for the Web API 2 and MVC 5 integrations in Autofac
- The WFS and WMS Services OGC Web Services for accessing Geographic Data
- The Design of Sites: Patterns, Principles, and Processes for Crafting a Customer-Centered Web Experi
- 笔记学习Smashing The Stack for Fun and Profit example 3--怎样修改返回地址。
- Sharepoint 2013 安装中 Config Application Server and Web Server role for the Server 失败 (iisext.vbs)
- Get the content of an Iframe in Javascript – crossbrowser solution for both IE and Firefox
- The gSOAP Toolkit for SOAP Web Services and XML-Based Applications
- ASP.NET Podcast Show #11 - Intro to Ajax and the Ajax Library for .NET
- disable-the-loopback-check-for-specific-host-names-on-all-sharepoint-web-and-application-servers/
- LUA学习笔记2-Iterators and the Generic for
- FAQ: Does the Web ADF for .NET version 9.2 support Microsoft AJAX 1.0?
- Semantic Web for the Working Ontologist: Effective Modeling in RDFS and OWL