if document contains "string", then alert('Hello World!')

Discussion in 'JavaScript' started by pgiddy, Jun 26, 2007.

  1. #1
    How would I do this? I'm a total javascript n00b.

    If a loaded document contains a particular string such as "dinosaur", I would like to execute:

    alert('Hello World!')


    Thanks!
     
    pgiddy, Jun 26, 2007 IP
  2. +:::Spider25:::+

    +:::Spider25:::+ Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Depending of the browser to use there are two methods
    Netscape based
    window.find(string)
    Internet Explorer
    range.findText(string)

    google them or give some feedback.
     
    +:::Spider25:::+, Jun 26, 2007 IP