Working
Example: (click
the following text to see it work)
You better believe DigitalPimp is!
Now your saying this looks the same Mr. DP but if you look
closer you will realize that it isn't. If you notice this
time we didn't have to declare an ID for the element because
when you use Javascript in HTML every element is already
given a instance name but I'm not going to get too far into
that, we will save it for the next tutorial. :) Anywho, back
to the script as you can see and explained above we didn't
need to declare an ID for the element and also you can see
that now we can use that one function all over the page to
pull out any text incased in HTML. Pretty nifty huh?
Below is a working example of how you could apply this
script in a practical matter on your site.
Real life use
Oh k, for the cool stuff! Let's apply this script to an
actual website. Let's say that you are developing this
really cool web site that is being updated all the time and
you don't want it to be THAT much work to just post an
update file. Here is how you can apply the above function to
this. Here we go...
This is the function that I am using this to grab the
innerText of the <TD>, do a pop-up window and add on the
date as an anchor tag to the end of the url of the pop-up
window.
Here is the HTML of the table below. As you can see, I
had to utilize style tags to fake a hyperlink so that it is
more visible to a user that you can click on the dates.
Updates |
7-03-2003 |
7-06-2003 |
7-41-2003 |
Finally, here is some code from the pop-up window just
showing you how I make sure that the date in the table cell
above is identical to the date in the anchor tag.