Results 1 to 3 of 3

Thread: Counting keyword on your html page (not form)

  1. #1
    Join Date
    May 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Counting keyword on your html page (not form)

    Hi, i am relatively new to js, so appreciate all the help.

    Lets say i want to count the total number of times the word "three" appears on my page and display the counted number, is that possible? Been searching high and low but all seems to involve counting words only in form.

    Thanks and regards

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    This would be possible using PHP.

    PHP Code:
    <?php
    $file 
    file_get_contents('thispage.php');
    $num substr_count($file,'myword')-1;
    //subtract one for the actual word in the above line
    echo $num;
    ?>
    I'm not sure if this is possible with Javascript, though it would be fairly slow and hard to setup, I think.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks, guess its time for me to start learning PHP

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •