tailieunhanh - DHTML Utopia Modern Web Design Using JavaScript & DOM- P12
DHTML Utopia Modern Web Design Using JavaScript & DOM- P12:In a single decade, the Web has evolved from a simple method of delivering technical documents to an essential part of daily life, making and breaking relationships and fortunes along the way. “Looking something up on the Internet,” by which is almost always meant the Web, is now within reach of almost anyone living in a first-world country, and the idea of conducting conversations and business (and probably orchestras) in your Web browser is no longer foreign, but part of life | Chapter 8 Remote Scripting style head body h1 A simple iframe h1 p Below is an iframe styled in size with CSS and displaying a different document. p iframe id myframe src iframe body html The HTML document displayed by the iframe is trivial and unstyled File DOCTYPE HTML PUBLIC - W3C DTD HTML EN http TR html4 html body p This is a document em in em the iframe. p body html Figure shows the page display Figure . The document with an iframe that displays another document. A simple iframe Below is an frame styled in size with CSS and displaying a different document. This is a document in the frame. 200 Licensed to siowchen@ Using iframe There s no sign that the iframe document is separate from that which surrounds it. Replacing iframes You can change the document that displays inside the iframe using a script located in the surrounding document. If the iframe is styled so as not to draw attention to itself this technique creates the illusion that part of the parent document has changed. The iframe element s src attribute is like other attributes on HTML elements available as a property of the corresponding DOM object. Here s a simple script that can be called from a button press or link click it merely changes the document displayed in the iframe script type text javascript function changeIFrame myframe .src http script This example is so simple it doesn t even need JavaScript. iframes act like normal frames and can therefore be the target of any hyperlink. You can display a link s destination in an iframe by setting the target attribute on the link to the name of the iframe. Retrieving Data with iframes With further scripting it s possible for the iframe s newly-loaded page to pass data back to its parent page. Scripts in the iframe content page can call functions in the parent page by referring to those parent-page functions as .
đang nạp các trang xem trước