Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Taking_Your_Talent_to_the_Web.pdf
Скачиваний:
5
Добавлен:
11.05.2015
Размер:
9.91 Mб
Скачать

Taking Your Talent to the Web

299

Notice that it is possible to create dynamic web effects in web pages that live on your desktop—without requiring a web server. Hooray for JavaScript!

A Cautionary Note

Like everything you can do on the Web, modifying the default status bar message involves trade-offs and thus requires thought. Browsers use defaultStatus to communicate with users, letting them know if they’ve connected or not, informing them when an object is being downloaded, and letting the geeks in the house keep track of the actual URLs to which your links point. Modifying defaultStatus can enhance site branding and please your client, but it might upset some users, so don’t use JavaScript in this way unless the benefits outweigh the drawbacks.

Kids, Try This at Home

Before we go any further, try reproducing the JavaScript effects we just described in a simple HTML page you’ve written. Needless to say, you will not win any innovation awards, but it might help you conquer any lingering fear of programming. If you can do this simple thing, you can do other, somewhat more complex things.

When it works on a page you’ve created, you’ll begin to feel like a web designer. If it doesn’t work, you’ll really begin to feel like a web designer.

Then you’ll go back and fix your syntax. Speaking of which…

The fine print

Because single quotation marks are used to denote the beginning and ending of text messages, what do you do if your text includes an apostrophe? After all, in HTML, an apostrophe is exactly the same as a single quotation mark.

What you do is “escape” the single quotation mark by inserting a backslash character in front of it.

Lip smackin’ good! Get <a href=”/recipes/stupidcomeon.html “ onMouseOver=”window.status=’Our chef\’s favorites.’; return true;” onMouseOut=”window status=’’;return true;”>the recipes</a>.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]