Implementing DHTML in WebExpress

 

 Detect script: 

Currently in WebX:

To make this easier in WebX:

To add the detect script:

Edit>Scripts

Paste in the following code:
// browser detect
IE = (document.all); NS = (document.layers); DOM = (document.getElementById); if (!NS && !IE && !DOM) unable='yes'; else unable = '';
frontbit = (NS) ? 'document.' : '';
endbit = (NS) ? '' : '.style';
bgcolorbit = (NS) ? '.bgColor' : '.backgroundColor';
bgimagebit = (NS) ? '.background.src' : '.backgroundImage.src';
fgcolorbit = (NS) ? '.fgColor' : '.color';
widthbit = (NS) ? '.width' : '.pixelWidth'
heightbit = (NS) ? '.height' : '.pixelHeight'
if (DOM)
wholebit = 'document.getElementById(name).style';

 

Add the 'detect.js' script whenever you use a script which needs a newer browser.

 

 

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

The script needs to run before any DHTML-DIV type scripts... preferably in the head of the document.  It should be placed directly into the code.

 
// browser detect
IE = (document.all); NS = (document.layers); DOM = (document.getElementById); if (!NS && !IE && !DOM) unable='yes'; else unable = '';
frontbit = (NS) ? 'document.' : '';
endbit = (NS) ? '' : '.style';
bgcolorbit = (NS) ? '.bgColor' : '.backgroundColor';
bgimagebit = (NS) ? '.background.src' : '.backgroundImage.src';
fgcolorbit = (NS) ? '.fgColor' : '.color';
widthbit = (NS) ? '.width' : '.pixelWidth'
heightbit = (NS) ? '.height' : '.pixelHeight'
if (DOM)
wholebit = 'document.getElementById(name).style';

>>