[Javascript] Loading Problem

Matt Barton javascript at mattbarton.org
Wed Sep 15 06:45:46 CDT 2004


Well, the sScriptTag was just me creating a variable to act as a reference
to the named script tag.  Nothing strange going on there.

The script tag attributes "for" and "event", however, if you don't already
know about them, can be very useful.  I use them often.  You can use them to
bind object events to script tags: for instance, in the example I provided
earlier the code would run when the window loads.

You could, for example do this ...

<img src="a_pretty_picture.jpg" id="myPic">
<script language="javascript" for="myPic" event="onmouseover">
    alert ('The mouse went over the picture');
</script>

... if you wanted.

There's many different ways to do exactly the same thing (I'll provide
examples if you want), it just so happens that this method is particularly
useful for me, given the mechanisms that build up pages in my intranet
system.

Should be noted that (according to O'Reilly) Netscape doesn't support these
features.

Matt

----- Original Message ----- 
From: "Tim Makins" <spindrift at oceanfree.net>
To: "[JavaScript List]" <javascript at LaTech.edu>
Sent: Wednesday, September 15, 2004 12:31 PM
Subject: Re: [Javascript] Loading Problem


> 'Top of the morning' to you, Matt. (haha I bet you think we say that all
the
> time here in Ireland, begorragh) !!
>
> My question to you: what does the 'script for' command do, and the
> 'sScriptTag'? I've never seen them before.
>
> Tim in Ireland.
>
> ----- Original Message ----- 
> From: "Matt Barton" <javascript at mattbarton.org>
> To: "[JavaScript List]" <javascript at LaTech.edu>
> Sent: Wednesday, September 15, 2004 10:59 AM
> Subject: Re: [Javascript] Loading Problem
>
>
> > Morning,
> >
> >
> > Could you try something like:
> >
> > <html>
> >     <body>
> >         <script src="" id="thescripttag"></script>
> >         <script for="window" event="onload">
> >             sScriptTag = document.getElementById ('thescripttag');
> >             sScriptTag.src = 'path_to_script_file_that_you_want';
> >         </script>
> >     </body>
> > </html>
> >
> > No idea if it'll do the trick, but it might be worth trying.
> >
> > Matt
> >
> > ----- Original Message ----- 
> > From: "Tim Makins" <spindrift at oceanfree.net>
> > To: "[JavaScript List]" <javascript at LaTech.edu>
> > Sent: Wednesday, September 15, 2004 10:53 AM
> > Subject: [Javascript] Loading Problem
> >
> >
> > > // US Counties_3 OK-WY
> > > viewlist4 = {
> > > colname: ["Name","State_name","Abbr","Fips","Area sq-mile","Area
> > > sq-km","Population","Pop Density"],
> > > colwidth: [20,20,6,6,12,12,12,12],
> > > coldata: [
> > >
> >
>
{z0:"Adair",z1:"Oklahoma",z2:"OK",z3:"40001",z4:"591.17320",z5:"1043.41",z6:
> > > "21038",z7:"35.6"},
> > >
> >
>
{z0:"Alfalfa",z1:"Oklahoma",z2:"OK",z3:"40003",z4:"874.94888",z5:"2266.11",z
> > > 6:"6105",z7:"7.0"},
> > >
> >
>
{z0:"Atoka",z1:"Oklahoma",z2:"OK",z3:"40005",z4:"973.33720",z5:"2520.93",z6:
> > > "13879",z7:"14.3"},
> > >
> >
>
{z0:"Beaver",z1:"Oklahoma",z2:"OK",z3:"40007",z4:"1842.68875",z5:"1162.12",z
> > > 6:"5857",z7:"3.2"},
> > >
> >
>
{z0:"Beckham",z1:"Oklahoma",z2:"OK",z3:"40009",z4:"907.61378",z5:"2350.71",z
> > > 6:"19799",z7:"21.8"},
> > >
> >
>
{z0:"Blaine",z1:"Oklahoma",z2:"OK",z3:"40011",z4:"943.23562",z5:"10945.95",z
> > > 6:"11976",z7:"12.7"},
> > >
> >
>
{z0:"Bryan",z1:"Oklahoma",z2:"OK",z3:"40013",z4:"936.78878",z5:"2426.27",z6:
> > > "36534",z7:"39.0"},
> > >
> >
>
{z0:"Caddo",z1:"Oklahoma",z2:"OK",z3:"40015",z4:"1280.94512",z5:"3317.63",z6
> > > :"30150",z7:"23.5"}
> > > ]
> > > }
> > >
> > >
> > > Today's question:
> > >
> > > My table-viewer uses a number of data-files, such as the above (a
> > shortened
> > > version). It is stored as 'table_uscount1.js', and will be loaded by
> > > including the line:
> > >
> > > <script src="gaz/table_uscount1.js"></script>
> > >
> > > at the top of the page that processes it. However, if there are a lot
of
> > > these files, the 'load' gets very big and takes time. Is there a way
to
> > only
> > > load the one I want, when it is asked for ??
> > >
> > > Tim in Ireland.
> > >
> > > _______________________________________________
> > > Javascript mailing list
> > > Javascript at LaTech.edu
> > > https://lists.LaTech.edu/mailman/listinfo/javascript
> > >
> > > -- 
> > > This email has been verified as Virus free
> > > Virus Protection and more available at http://www.plus.net
> >
> > _______________________________________________
> > Javascript mailing list
> > Javascript at LaTech.edu
> > https://lists.LaTech.edu/mailman/listinfo/javascript
> >
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> -- 
> This email has been verified as Virus free
> Virus Protection and more available at http://www.plus.net




More information about the Javascript mailing list