views:

8

answers:

1

Hello -

Here is what I would like to ideally do within my HTML - I would like to insert a bit of javascript that checks to see if a certain directory name is listed in the current user's URL and if so, output copy on the page. For example:

If the current URL has the word "trigger" in it such as:

http://www.mysite.com/pages/trigger/dosomestuff.html

then I want to output "confirmed" on the page.

I am not too familiar with javascript, so I am hoping that someone can help!

Thanks!

+1  A: 
if (location.href.match("trigger"))
{
    document.write("<h1>confirmed!</h1>")
}
Byron Whitlock
Will it not replace the content of existing page with the word confirmed.
sushil bharwani
This is working perfectly! Thank you! (that was very easy)
Tyler
@sushil, only if you are using netscape 3 or 4 ;)
Byron Whitlock