[ale] Java Script Question.

Cor van Dijk cor.angela at mindspring.com
Sat Aug 21 12:52:23 EDT 1999


--------------447FA45F52EB8A5C15F04BCB
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Vijayaraman.S,J16 Chennai wrote:

>
>
> hi all,
>  this is  a java script question.
>   I have a particular script which i want to exectute from several
> pages and i should have a
>   single script file for this,how can i do this and how should i call
> this script from the other HTML files??
>
> thanx in advance for ur kind help,
> vijay
>
> Regards,
> S. VIJAYARAMAN,
> HCL Technologies India (Pvt) Ltd.,
> Chennai,India .
> Email : vijayaraman at msdc.hcltech.com

Answer is too long to print here, but you can find it in gory detail on
page 106, 107 of "Dynamic HTML" by Danny Goodman (O'Reilly). Sorry,
O'Reilly does not seem to have a download file for the examples in that
book., at least not at the time of printing (July 98). They may have it
now, try, start with www.oreilly.com. You need example 5-5.
Personally I have used a different technique: I fire up a separate
window from a script within a frame header of the main window (either
when loading or later, with a click event). The reference to this
separate window  can be used to manipulate its content from within other
windows. Procedure probably needs some modification if one does not use
frames; then the script probably should go in the top window. Trick
works for both Navigator and Internet Explorer, be it with minor browser
specific accomodation.
Here follows the main part of the script:
...
function basket() {
 mand = window.open(filestring, "mok", features, true);
....
and here is a call to a function (slect0) in the "mok" window:
....

<INPUT TYPE="button" NAME="test" VALUE="Test the basket"
onClick="parent.mand.slect0(this,'Click')">
.......

"filestring" and "features" are browser specific, at least for my
purposes.
The basket is fired up from within one of the frames with:
.........
<INPUT TYPE=button NAME="basket" VALUE="Click here for a basket"
onClick="parent.basket()">
...............

--------------447FA45F52EB8A5C15F04BCB
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
</pre>
<HTML>
Vijayaraman.S,J16 Chennai wrote:
<BLOCKQUOTE TYPE=CITE> 
<P><FONT FACE="Arial">hi all,</FONT>
<BR><FONT FACE="Arial"> this is  a java script question.</FONT>
<BR><FONT FACE="Arial">  I have a particular script which i want to
exectute from several pages and i should have a</FONT>
<BR><FONT FACE="Arial">  single script file for this,how can i do
this and how should i call this script from the other HTML files??</FONT>
<P><FONT FACE="Arial">thanx in advance for ur kind help,</FONT>
<BR><FONT FACE="Arial">vijay</FONT>
<P><B><FONT FACE="Courier New"><FONT SIZE=-1>Regards,</FONT></FONT></B>
<BR><FONT SIZE=-1><B><FONT FACE="Courier New"><FONT COLOR="#008080">S.
VIJAYARAMAN</FONT></FONT></B><FONT FACE="Arial"><FONT COLOR="#000000">,</FONT></FONT></FONT>
<BR><B><I><FONT FACE="Courier New"><FONT COLOR="#0000FF"><FONT SIZE=-1>HCL</FONT></FONT></FONT></I>
<FONT FACE="Courier New"><FONT COLOR="#0000FF"><FONT SIZE=-1>Technologies
India (Pvt) Ltd.,</FONT></FONT></FONT></B>
<BR><FONT FACE="Courier New"><FONT COLOR="#000080"><FONT SIZE=-1>Chennai,India
.</FONT></FONT></FONT>
<BR><B><FONT FACE="Courier New"><FONT COLOR="#008080"><FONT SIZE=-1>Email</FONT></FONT></FONT></B>
<FONT FACE="Arial"><FONT COLOR="#000000"><FONT SIZE=-1>:</FONT></FONT></FONT><U>
<FONT FACE="Bookman Old Style"><FONT COLOR="#0000FF"><FONT SIZE=-1>vijayaraman at msdc.hcltech.com</FONT></FONT></FONT></U></BLOCKQUOTE>
Answer is too long to print here, but you can find it in gory detail on
page 106, 107 of "Dynamic HTML" by Danny Goodman (O'Reilly). Sorry, O'Reilly
does not seem to have a download file for the examples in that book., at
least not at the time of printing (July 98). They may have it now, try,
start with www.oreilly.com. You need example 5-5.
<BR>Personally I have used a different technique: I fire up a separate
window from a script within a frame header of the main window (either when
loading or later, with a click event). The reference to this separate window 
can be used to manipulate its content from within other windows. Procedure
probably needs some modification if one does not use frames; then the script
probably should go in the top window. Trick works for both Navigator and
Internet Explorer, be it with minor browser specific accomodation.
<BR>Here follows the main part of the script:
<BR>...
<BR>function basket() {
<BR> mand = window.open(filestring, "mok", features, true);
<BR>....
<BR>and here is a call to a function (slect0) in the "mok" window:
<BR>....
<P><INPUT TYPE="button" NAME="test" VALUE="Test the basket"   
onClick="parent.mand.slect0(this,'Click')">
<BR>.......
<BR> 
<BR>"filestring" and "features" are browser specific, at least for my purposes.
<BR>The basket is fired up from within one of the frames with:
<BR>.........
<BR><INPUT TYPE=button NAME="basket" VALUE="Click here for a basket"
onClick="parent.basket()">
<BR>...............</HTML>

--------------447FA45F52EB8A5C15F04BCB--






More information about the Ale mailing list