Text Link Ads!

What is Text Link Ad ?

As name suggests, its a simple text on your website or blog which hyperlinks to another webpage of an advertiser.  For those text link ads advertiser pays you.

Text Link ad is one of my favorite. I was very fascinated by the text link ad code implemented by kontera
I think they are best in the industry. I wanted to develop something like that but couldn’t!!
Here I tried to parse html code so that my text link ad server can attach some special effects to it(not like them).
One thing you need for this is good knowledge of Javascript DOM. Lets Start!
You must add effects such that your basic design wont get affected,for that you should exclude some basic html tags like ‘A’, ‘INPUT’ etc.
Lets define some html tags those must get ignored while parsing.

and the function which check for ignored tags is

This function is quiet simple! hope you’ll figure it out.
After this we’ll start scanning document body.
We’ll search only text nodes in the body. Like

Here you can call this function as scanNode(document.body);
This function gets all the child node and goes on checking for node type.
If node is one of we don’t want to process it skips that.
Also text node(nodeType==3) with blank text are skipped. If node found,
it self is parent node, scanNode is called for this parent recursively.
suppose we have a keyword to be highlighted then text node is sent to another function where exact keyword is matched and processed.

Thats all about this post. Any queries you can put comments!!

One Comment
  1. Aj
    April 11, 2007 | Reply

Add a Comment

Your email address will not be published. Required fields are marked *