JavaScript Editor Ajax software     Free javascripts 



Main Page

See the “How to use” documentation at
http://wiki.novemberborn.net/sifr/How+to+use
for
more details about using sIFR.
After adding this last bit of code, you’re done! Your page will now work by default with replaced text. If
Flash or JavaScript aren’t supported by the user agent, it falls back gracefully to the default page font.
Stewart Rosenberger’s Text Replacement Method
This method uses JavaScript to replace page headings with images. The images are created by a PHP
script on-the-fly, so you don’t have to build the images yourself. It is otherwise very similar to sIFR.
For this technique to work, there are two prerequisites:
?
The PHP server must have the GD2 library installed. This is PHP’s image manipulation library,
and you can learn more about it at
http://www.php.net/image/
.
?
You need to have access to the font file of the font you want to use, because you’ll need to copy
it in your web site folder.
Assuming these two conditions are met, you can go on and modify the
popup.php
script that you
created earlier in this chapter, and have its header replaced by graphically rendered text when the page
loads. Figure 6-10 shows how the page will look after the exercise is completed, and Figure 6-2 shows
how the page looks right now.
Replacing Text with Images
1.
Start by enabling the GD2 PHP library, which you need for generating images on-the-fly with
PHP. If you set up your machine as described in Chapter 1, you have GD2 already installed, but
it may not be enabled by default. Open for editing the
php.ini
configuration file. In the typical
XAMPP configuration, this file is located in the
\xampp\apache\bin
folder. In other scenarios,
you’ll find it in your Windows folder.
replaceElement() Parameter Description
nPaddingLeft
Left padding in pixels.
sFlashVars
Parameters to send to the Flash movie. When multiple parameters
are used, separate them by
&
. Supported parameters are
textalign
,
offsetLeft
,
offsetTop
, and
underline
.
sCase
Set this to
upper
to transform the text to uppercase, and
lower
to
transform the text to lowercase.
sWmode
Supported values are
opaque
(the default) and
transparent
(to
enable transparent background).
137
Chapter 6: SE-Friendly HTML and JavaScript
c06.qxd:c06 10:55 137


JavaScript Editor Ajax software     Free javascripts