XUL Programmer's Reference Manual

<iframe> Attributes

Attributes Common Children
id * * *
type  
name  
src  
flex  
onblur  
onfocus  

<iframe> is a functional, embeddable widget that provides editing functionality to the user. Use the src attribute to load content into the iframe window (including src="about:blank") to specify a new, blank page for editing. And see the types specified in NS6 to familiarize yourself with blah blah..
 

 

type
Description
type is an optional attribute that specifies the type of content window.
Syntax
<iframe type="type" ...>

Example
<iframe type="content-primary" id="main-window">

Notes
"content-primary" is the type used for the main iframe in Netscape 6. Just as the class attribute affects the way that the chrome is rendered, the type attribute affects the way that the content is treated in the browser. Different iframe types appearing in the Mozilla browser include:
  • content-primary denotes the main iframe window
  • content is another common type for Composer-like iframes in the Mozilla application

 


 

name
Description
name is an optional attribute that specifies the name of content window.
Syntax
<iframe name="name" ...>

Example
<iframe name="content-primary" id="main-window">

Notes
The name attribute is used instead of the id to reference a content window from other parts of the chrome, as when a button loads new content by changing the attribute on the named iframe:

 
<iframe name="main-iframe">

...

function loadPage() {
  ed = document.getElementById("main-iframe")
  ed.setAttribute("src", "newpagetoedit.html")
}

You cannot fetch content window (i.e. getElementById(id)) using the id attribute.


 


 

src
Description
src is the attribute used to load content into the content window.
Syntax
<iframe src="HTML content file" ...>

Example
<iframe id="main-window" src="about:blank">

Notes
Use JavaScript to set the src attribute from the UI:

 
<iframe name="main-iframe">

...

function loadPage() {
  ed = document.getElementById("main-iframe")
  ed.setAttribute("src", "newpagetoedit.html")
}


 


 

onblur
Description
onblur is an event listener attribute for handling the event raised when the iframe loses focus.
Syntax
<element onblur="javascript event handler code">
Example
<iframe onblur="blurWindow()">
Notes
None.


 

onfocus
Description
onfocus is an event listener attribute for handling the event raised when the iframe gets focus from the user.
Syntax
<element onfocus="javascript event handler code">
Example
<iframe onblur="focusWindow()">
Notes
None.


 


 
 

Last updated: 5/25/00 Ian Oeschger