Javascript [Electronic resources] : The Definitive Guide (4th Edition) نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Javascript [Electronic resources] : The Definitive Guide (4th Edition) - نسخه متنی

David Flanagan

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید

Chapter 13) does. For example, thehref property of a Link object contains thecomplete text of the URL to which it is linked, while thehostname property contains only the hostnameportion of that URL. See the client-side reference section for acomplete list of these URL-related properties.

Chapter 21 fora complete discussion of JavaScript security, including a descriptionof how to avoid this security restriction with signed scripts.

Section 13.3, where it was used with both<a> and <area> tagsto change the message in the browser's status line when themouse Chapter 19 for details.

Finally,it is worth mentioning that href and the otherURL properties of the Link object are read/write. Thus, you can writea JavaScript program that dynamically modifiesthe destinations of hypertext links! Here is a frivolous piece ofJavaScript-enhanced HTML that uses a Link event handler to write tothe href property and create a link whosedestination is randomly chosen from the set of otherlinks in the document:

<a href="   onmouseover="status = 'Take a chance... Click me.'; return true;"  
onclick="this.href =
document.links[Math.floor(Math.random( )*document.links.length)];">
Random Link</a>

This example demonstrates all the features of the Link object thatwe've considered: the links[] array, the useof Link event handlers, and the dynamic setting of the destination ofa link. Note that the example sets the hrefproperty of the link but doesn't bother to read thehref property of the link it randomly chooses.Instead, it relies on the toString( ) method ofthe Link object to return the URL.

/ 844