JavaScript Editor Ajax software     Free javascripts 



Main Page

of
catalog.php
, uses the
sIFR.replaceElement()
function to replace all
<h1>
tags with Flash files
that render text:
<!-- sIFR replacement code -->
<script type=”text/javascript”>
// continue only if the sIRF code has been loaded
if(typeof sIFR == “function”)
{
// replace the <h1> text
sIFR.replaceElement(named({sSelector:”body h1”, sFlashSrc:”./sifr/super_font.
i
swf”}));
};
</script>
The
(typeof sIFR == “function”)
condition verifies that the sIFR library has been loaded success-
fully, so the script won’t attempt to call
sIFR.replaceElement()
in case you forgot to reference the
sIFR JavaScript library.
The
replaceElement()
function supports more parameters, but the necessary ones are
sSelector
(which defines which HTML elements should be replaced), and
sFlashSrc
(which references the Flash
movie containing the font to be used). However, many more parameters are supported, and can be used
when you need to fine-tune the replacement options. Table 6-2 contains the list of parameters that you
can use with
replaceElement()
.
Table 6-2
replaceElement() Parameter Description
sSelector
The CSS element you want to replace. Include whitespace in the
string
only
when selecting descendants, such as in
body h1
. You
can separate multiple CSS elements using commas.
sFlashSrc
The Flash file that contains the font.
sColor
The text color using hex notation.
sLinkColor
The link color using hex notation.
sHoverColor
The hover link color using hex notation.
sBgColor
The background color using hex notation.
nPaddingTop
Top padding in pixels.
nPaddingRight
Right padding in pixels.
nPaddingBottom
Bottom padding in pixels.
136
Chapter 6: SE-Friendly HTML and JavaScript
c06.qxd:c06 10:55 136


JavaScript Editor Ajax software     Free javascripts