[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Re: Preloading Images

Subject: Re: Preloading Images
From: Dan Morrison <dman@xxxxxxxx>
Date: Tue, 18 Jul 2000 13:37:16 +1200
preload images
Sia Rahimi wrote:

> I would like to generate the following html snippet:
> 
> <body bgcolor="#ffffff" onLoad="PreloadImages
> ('images/image1.gif','images/image2.gif','images/image3.gif');">

I would predict a few headaches getting your quoting right using that
approach. It can be done (reasonably easily) but I'd advise stepping out
of the onload to get it done.

<body bgcolor="#ffffff" onLoad="doPreloadImages()" >

<script>
function doPreloadImages(){
  Preload('images/image1.gif');
  Preload('images/image2.gif');
  Preload('images/image3.gif');
}
</script>

This means you won't have to contend with nested "''"

A template could be of the form:

<xsl:template match="LeftNavList">
  <script>
    function doPreloadImages(){
    <xsl:for-each select="PreLoadImage">
      Preload('<xsl:value-of select="." />');
    </xsl:for-each>
    }
  </script>
</xsl:template>


Advantages include clearer readability (IMO, although it can be
compressed back into your original PreloadImages(..,..,..) if you
prefer)
and it means the LeftNavList can be matched at any point in the page,
instead of attaching itself to the 'body' template.

There are more elaborate (generic) approaches and also more succinct
ways, like your original, but hopefully this will give you enough
pointers.

cheers,

.dman.


:=====================:====================:
: Dan Morrison        : The Web Limited    :
:  http://here.is/dan :  http://web.co.nz  :
:  dman@xxxxxxxx      :  danm@xxxxxxxxx    :
:  04 384 1472        :  04 495 8250       :
:  025 207 1140       :                    :
:.....................:....................:
: If ignorance is bliss, why aren't more people happy?
:.........................................:


 XSL-List info and archive:  http://www.mulberrytech.com/xsl/xsl-list


Current Thread

PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.