December 13th, 2002, 10:38 AM
I'm using the following to print out the document title of a webpage:
What I'd like to do is find out if the title contains the word "collection" and if it does,
have the word Articles (plural) print instead of just Article (singular).
How would I a) find out if the title contains the word Collection and
b) write the if/then to print out appropriate form of the word Article?
Thanks for any help you can offer.
December 13th, 2002, 10:47 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
var t = document.title;
document.write (t + ' ');
document.write((t.toLowerCase().indexOf('collection') == -1) ? 'Article' : 'Articles');
December 13th, 2002, 11:29 AM
Awesome - thanks! That does exactly what I needed!