Home arrow JavaScript arrow Dynamic Text Replacement with JavaScript
JAVASCRIPT

Dynamic Text Replacement with JavaScript


As a web site designer and developer, you know that engaging your visitors often means enhancing your site with graphics. You also know that text is important, both for providing those visitors with information and for helping search engine spiders index your site. In this series you will learn how to perform Dynamic Text Replacement, a technique that balances both of those needs.

Author Info:
By: Alejandro Gervasio
Rating: 5 stars5 stars5 stars5 stars5 stars / 10
September 19, 2007
TABLE OF CONTENTS:
  1. · Dynamic Text Replacement with JavaScript
  2. · Using Dynamic Text Replacement in a concrete case
  3. · Seeing Dynamic Text Replacement in action
  4. · Completing the dynamic text-replacement script

print this article
SEARCH DEVARTICLES

TOOLS YOU CAN USE

advertisement
Dynamic Text Replacement with JavaScript
(Page 1 of 4 )

Introduction

If you’ve been building web sites for long time, then you’ll probably know that text is considered the best format in which to deliver contents to end users. Regardless of the nature of a specific web site, it’s nearly mandatory that it must include concrete, well-structured sections of text, particularly on those topics that are relevant to the web site's context. 

This makes perfect sense when you consider that the web is completely based on the functionality of the well-know Hypertext Transfer Protocol (HTTP for short). Definitely, coding web pages that contain text-based headers, navigation bars and well-defined paragraphs, among other elements, is a big step toward building accessible, standard web documents. The benefits in doing so don’t stop here, since most search engine spiders work much better at indexing text-based contents than other kinds of material.

So, summarizing, it’s clear to see that creating text-based web pages is a good habit, especially when we focus on the advantages of making web documents much friendlier to search engine bots.

But are there any problems with this approach? Well, as you might have guessed, when you provide visitors to your web site with tens of pages that only contain gray, arid text, the whole surfing experience becomes extremely boring and unpleasant. This could cause you to lose precious traffic in the near future.

Also, it’s fair to mention that building a web document by using the three or four font types available on most modern browsers can be a frustrating limitation. This is especially true when you’re trying to release all of your creative inspiration to create a killer web site.

So does this mean that you have to part from those professional web page coding habits and start creating low-quality web sites? Absolutely not! In this case, the assistance of JavaScript can be really useful. Suppose for a moment that you’re developing a web document whose <h2> headers are made of pure text, but you need to make them look slightly more attractive by using a non-conventional font type. How can this be achieved?

Well, it’s possible to create the <h2> headers by using traditional font types, and then after the web page has been loaded, replace them with fancy images via some DOM scripting. Sounds interesting, right? On one hand you’re coding highly standard, text-based headers, and on the other hand JavaScript substitutes appealing graphics (if scripting is enabled in the browser).

This technique, known as Dynamic Text Replacement, was developed originally by Paul Peter Koch. It can be remarkably useful. In the course of this series I’ll be demonstrating its basic implementation with some concrete hands-on examples, and then, with the theory well underway, I’ll show you how to extend its functionality to other cases.

Thus, are you prepared to learn how to put Dynamic Text Replacement to work for you? Let’s begin now!


blog comments powered by Disqus
JAVASCRIPT ARTICLES

- More Top jQuery Tutorials for Beginners
- More Top jQuery Plugins for Menus
- Top jQuery Tutorials for Beginners
- New UI Framework and SDK for JavaScript Rele...
- JavaScript OpenPGP Tool, Node.js 0.6.3 Avail...
- Yahoo Releases Cocktails Language and Develo...
- Customizing jQuery Slideshows: Dynamic Contr...
- Customizing jQuery Slideshows: the animate()...
- Customizing jQuery Slideshows: slideUp() and...
- Customizing jQuery Slideshows: hide() and sh...
- Web Workers: Performing Calculations in Para...
- More Top JavaScript Frameworks and Libraries
- More Dynamic jQuery Styling Techniques
- The Top JavaScript Libraries
- The Top JavaScript Frameworks

Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 



© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 9 - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials