<frame> Creating Individual FramesYou use the <frame> element to create an individual frame. This element is an empty element, and you use it inside the <frameset> element. It's supported in XHTML 1.0 Frameset only. Here are its attributes:
This element does not support any XHTML events. You can use the <frame> element inside a <frameset> element to create a frame. This element exists so that you can specify the document that is displayed in a URI. That's the one required attribute in this element: src , which holds the URI of the document the frame is to display. For example, here's how I might display two frames, placing the contents of the document ch17_08.html in one and ch17_09.html in the other: Listing ch17_07.html<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Using XHTML Frames </title> </head> <frameset cols = "50%, 50%"> <frame src="ch17_08.html" /> <frame src="ch17_09.html" /> </frameset> </html> Here's ch17_08.html: Listing ch17_08.html<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Using XHTML Frames </title> </head> <body bgcolor=red> <h1> <center> This is frame 1. </center> </h1> </body> </html> And here's ch17_09.html: Listing ch17_09.html<?xml version="1.0"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title> Using XHTML Frames </title> </head> <body bgcolor=cyan> <h1> <center> This is frame 2. </center> </h1> </body> </html> The result of this XHTML appears in Figure 17-5. Figure 17-5. Displaying XHTML frames.
That's all it takes to create and display frames in XHTML, but bear in mind that the W3C has apparently targeted frames for extinction . Will stylesheets be able to take over what frames do today? What about XFrames? That remains to be seen. I'll take a look at handling stylesheets now. |