Implementing DHTML in WebExpress


 Preload script: 

Currently in WebX:

To make this easier in WebX:

To add the preload script:


Name: src
Value: preload.js


preload ('list of image names which need to be pre-loaded separated by commas');

ex: preload ('linkson.gif, feedbackon.gif, indexon.gif');


The '<script src = 'preload.js'>'  tag should be generated whenever 'rollover.js' or 'switchimg.js' is used. 

It would be nice to have WebX generate the,
preload ('linkson.gif, feedbackon.gif, indexon.gif');

, part according to what images are chosen in the 'rollover.js', 'switchimg.js', 'linkstate.js', or 'changebgimage.js' scripts:

If a 'changeimg' function is called then the filename of the 'name' +  'on' should be added to the list. (it would have to find the image's filename by referencing its 'name', parse the extension, and then add the 'on'.... same goes for the linkstate script...)

If a 'switchimg' function is called then the value of the 'newimage.gif' should be added to the list.  (...same for changebgimage.js)


Rules/Problems with the 'preload.js' script:

The images must be in the same directory as the HTML files. 
The list will need to be updatable/re-written as you add functions to a web page.

function preload (names)
// Preloads images - 'names' variable is a list which is comma separated 
// Include extensions
 var nw = names.split(",");
 for (i=0; i<nw.length; i++)
 var nwbit = nw[i].split (".");
 eval (nwbit[0] + 'load= new Image();');
 eval (nwbit[0] + 'load.src = "' + nw[i] + '";');