Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống
1
/ 429 trang
THÔNG TIN TÀI LIỆU
Thông tin cơ bản
Định dạng
Số trang
429
Dung lượng
11,31 MB
Nội dung
[...]... standards 2 http://www .sitepoint. com/books /javascript1 /errata.php SimplyJavaScript xxi The SitePoint Forums If you’d like to communicate with other web developers about this book, you should join SitePoint s online community.3 The JavaScript forum,4 in particular, offers an abundance of information above and beyond the solutions in this book, and a lot of fun and experienced JavaScript developers hang... But you knew all that, right? This is a JavaScript book, after all, so let’s talk about the JavaScript that goes into your pages JavaScript for Behavior As with CSS, you can add JavaScript to your web pages in a number of ways: ■ You can embed JavaScript code directly in your HTML content: ■ You can include JavaScript code at the top of your HTML... Harbottle and Luke Cuthbertson, SitePoint s Co-founder and General Manager, who sat me down late in 2006 and—for the second time in my career—convinced me that stepping away from SitePoint s day-to-day operations to write a book wouldn’t be the worst career move ever I also owe a beverage to 3 4 http://www .sitepoint. com/forums/ http://www .sitepoint. com/launch/jsforum/ xxii SimplyJavaScript Simon Mackie,... simpler syntax: JavaScript code here ■ You can put your JavaScript code in a separate file, then link to that file from as many HTML documents as you like: ⋮ script.js (excerpt) JavaScript code here Guess which method you should use Writing JavaScript that enhances usability... hang out there It’s a good way to learn new tricks, get questions answered in a hurry, and just have a good time The SitePoint Newsletters In addition to books like this one, SitePoint publishes free email newsletters including The SitePoint Tribune, The SitePoint Tech Times, and The SitePoint Design View Reading them will keep you up to date on the latest news, product releases, trends, tips, and techniques... your HTML document in a tag: -JavaScript code here // > ⋮ 10 SimplyJavaScript CDATA? If you’re wondering what all that gobbledygook is following the tag and preceding the tag, that’s what it takes to legitimately embed JavaScript in an XHTML document without confusing web... JavaScript fits into the picture Chapter 2: Programming with JavaScriptJavaScript is a programming language To work with it, then, you must get your head around the way computer programs work—which to some extent means learning to think like a computer The simple concepts introduced in this 1 http://www .sitepoint. com/books/html1/ SimplyJavaScript xix chapter—statements, variables, expressions, loops,... nearby With JavaScript, you can bring that awkward puppet to life, lifting you as its creator from humble shop clerk to web design mastery! 1 Throughout this book, we’ll refer to HTML and XHTML as just HTML Which you choose is up to you, and doesn’t have a much to do with JavaScript In case it matters to you, the HTML code we’ll present in this book will be valid XHTML 1.0 Strict 2 Simply JavaScript. .. & CSS1 (Melbourne: SitePoint, 2006) What’s Covered in this Book? Chapter 1: The Three Layers of the Web A big part of learning JavaScript is learning when it’s the right tool for the job, and when ordinary HTML and CSS can offer a better solution Before we dive into learning JavaScript, we’ll take a little time to review how to build web sites with HTML and CSS, and see just how JavaScript fits into... the confidence not only to write JavaScript code of your own, but to understand code that was written by others, and even to spot harmful, old-fashioned code that's more trouble than it’s worth! Throughout this book, we’ve tried to go the extra mile by giving you more than just the basics In particular, we’ve covered some of the new JavaScript- powered devel- xviii SimplyJavaScript opment techniques—like .