Diff for /books/www/chapters/ch02.html between versions 1.5 and 1.6

version 1.5, 2002/10/03 21:21:12 version 1.6, 2002/10/04 21:02:17
Line 241  from the Mozilla navigator component--&g Line 241  from the Mozilla navigator component--&g
 <P>To access a script in XUL, use the <TT>script</TT> element  <!--INDEX XUL (XML-based User-interface Language):scripts, access;scripts:XUL, access --> and a URL value for its <TT>src</TT> attribute:  <P>To access a script in XUL, use the <TT>script</TT> element  <!--INDEX XUL (XML-based User-interface Language):scripts, access;scripts:XUL, access --> and a URL value for its <TT>src</TT> attribute:
 <PRE>&lt;script type="application/x-javascript"  <PRE>&lt;script type="application/x-javascript"
 src="chrome://xfly/content/xfly.js" /&gt;</PRE>  src="chrome://xfly/content/xfly.js" /&gt;</PRE>
<P>The <TT>dialogOverlay.js</TT> script imported into  <!--INDEX dialogOverlay.js script;scripts:dialogOverlay.js --> your XUL file in <A HREF="#77022">Example 2-4</A> provides access to the <TT>CenterWindoOnScreen( )</TT> function. This  <!--INDEX CenterWindowOnScreen( ) function, JavaScript;functions:JavaScript:CenterWindowOnScreen( );JavaScript:functions:CenterWindowOnScreen( ) --> function is made available to your XUL file with the line:<P>The <TT>dialogOverlay.js</TT> script imported into  <!--INDEX dialogOverlay.js script;scripts:dialogOverlay.js --> your XUL file in <A 
 HREF="#77022">Example 2-4</A> provides access to the <TT>CenterWindowOnScreen( )</TT> function. This  <!--INDEX CenterWindowOnScreen( ) function, JavaScript;functions:JavaScript:CenterWindowOnScreen( );JavaScript:functions:CenterWindowOnScreen( ) --> function is made available to your XUL file with the line:
 <PRE>&lt;script type="application/x-javascript"  <PRE>&lt;script type="application/x-javascript"
 src="chrome://global/content/dialogOverlay.js" /&gt;</PRE>  src="chrome://global/content/dialogOverlay.js" /&gt;</PRE>
 <P>All functions in <I>dialogOverlay.js</I> are imported into the scope of the XUL file and can be called directly, as <TT>CenterWindowOnScreen( )</TT> is in the <TT>onload</TT> event handler for the XUL window. Note that the functions contained in an imported JavaScript file are not broadcast in any particular way (though you can see them if you use the JavaScript Debugger). You may need to look around in the source code or see how other applications import files to find the functions you need, but the routines you want to use in your application code are probably already available in Mozilla.<A NAME="b260"></A><A HREF="#260">[*]</A>  <P>All functions in <I>dialogOverlay.js</I> are imported into the scope of the XUL file and can be called directly, as <TT>CenterWindowOnScreen( )</TT> is in the <TT>onload</TT> event handler for the XUL window. Note that the functions contained in an imported JavaScript file are not broadcast in any particular way (though you can see them if you use the JavaScript Debugger). You may need to look around in the source code or see how other applications import files to find the functions you need, but the routines you want to use in your application code are probably already available in Mozilla.<A NAME="b260"></A><A HREF="#260">[*]</A>

Removed from v.1.5  
changed lines
  Added in v.1.6


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>