Need help with code

Discussion in 'HTML & Website Design' started by allwayslearning, Jul 6, 2009.

  1. #1
    I have the html for a word counter my site visitors. I want to give them the opportunity to copy and past it with a link back to my site to get retuning visors. Someone asked this same kind of question but it was to provide link backs to there site, The code recommended was <textarea></textarea with the code between texarea words. I tried this putting the code for the word counter between <textarea></textarea and it created a small box of code that could be copied but when I copied it as a Visitor world and pasted it to into my site and it did not work. I would appreciate if if someone would tell me what to do I am new to html.
    .
    In response to the above post someone wrote me with some help but it did not work
    but I can't find the help provided when I tried to do what he sais and it did not work so I am posting the code and instructions here.

    Instructions I was given are below.
    Whatever code you place between the <textarea><!-- TWO STEPS TO INSTALL WORD COUNT:

    1. Copy the coding into the HEAD of your HTML document
    2. Add the last code into the BODY of your HTML document -->

    <!-- STEP ONE: Paste this code into the HEAD of your HTML document -->

    <HEAD>

    <SCRIPT LANGUAGE="JavaScript">
    <!-- Original: Shawn Seley -->

    <!-- This script and many more are available free online at -->
    <!-- The JavaScript Source!! http://javascript.internet.com -->

    <!-- Begin
    function CountWords (this_field, show_word_count, show_char_count) {
    if (show_word_count == null) {
    show_word_count = true;
    }
    if (show_char_count == null) {
    show_char_count = false;
    }
    var char_count = this_field.value.length;
    var fullStr = this_field.value + " ";
    var initial_whitespace_rExp = /^[^A-Za-z0-9]+/gi;
    var left_trimmedStr = fullStr.replace(initial_whitespace_rExp, "");
    var non_alphanumerics_rExp = rExp = /[^A-Za-z0-9]+/gi;
    var cleanedStr = left_trimmedStr.replace(non_alphanumerics_rExp, " ");
    var splitString = cleanedStr.split(" ");
    var word_count = splitString.length -1;
    if (fullStr.length <2) {
    word_count = 0;
    }
    if (word_count == 1) {
    wordOrWords = " word";
    }
    else {
    wordOrWords = " words";
    }
    if (char_count == 1) {
    charOrChars = " character";
    } else {
    charOrChars = " characters";
    }
    if (show_word_count & show_char_count) {
    alert ("Word Count:\n" + " " + word_count + wordOrWords + "\n" + " " + char_count + charOrChars);
    }
    else {
    if (show_word_count) {
    alert ("Word Count: " + word_count + wordOrWords);
    }
    else {
    if (show_char_count) {
    alert ("Character Count: " + char_count + charOrChars);
    }
    }
    }
    return word_count;
    }
    // End -->
    </script>

    </HEAD>

    <!-- STEP TWO: Copy this code into the BODY of your HTML document -->

    <BODY>

    <form>
    <textarea cols=40 rows=5 name=x>
    </textarea>
    <br>
    <input type=button value="Count Words" OnClick ="CountWords(this.form.x, true, true);">
    </form>

    <!-- Script Size: 2.04 KB --></textarea> tag
     
    allwayslearning, Jul 6, 2009 IP
  2. unblocker.net

    unblocker.net Peon

    Messages:
    16
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    put the below into your html file

    <form>
    <input type="button" value="Highlight All" onclick="javascript:this.form.txt.focus();this.form.txt.select();"><BR>
    After clicking the "Highlight All" button, hold the "CTRL" key on your keyboard and press "C".<BR>
    To insert the link code to your website's index page source code, hold the "CTRL" key and press "V".
    </div>
    <textarea name="txt" rows="2" cols="70" wrap="VIRTUAL">
    <b>your codings here</b>
    </textarea></form>
     
    unblocker.net, Jul 6, 2009 IP