Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Haunted <textarea>!

    This problem only occurs when I do a Refresh to the browser window -- which I only do in testing -- so it really doesn't matter. Except to my sanity.

    My hompage consists of a form with a <textarea>. Every time the a visitor returns to the homepage the text is different. Almost every time... there are five sets of text.

    This works just fine when you actually leave the homepage and go to any other URL, then return. You find the new text. But if you just do a Refresh -- even a Ctrl Refresh with Internet Explorer -- you see the new text flash in the <textarea> VERY quickly and then the old text appears and stays there.

    With each Refresh the text changes as it should but only flashes before the old text re-appears. Again, if you go to a new URL then return the "old text" will be changed.

    Here's some code so I don't get asked for it, but I suspect the answer to this will come from someone who better understands how browsers work.

    // Texts
    if (brType!="MIE"){bl=" \n"} else {bl=""}
    text1=bl+"1 Metric? Stones? Kilojoules? See Help";
    text2=bl+"2 BMI? BMR? See our FAQs";
    text3=bl+"3 See our Frequently Asked Questions (FAQs)";
    text4=bl+"4 Check our our Fat Loss Tips";
    text5=bl+"5 Check out Diet and Weight Loss Basics";
    text=text1;

    // Rotate text
    if (getCookie("textNumCookie")==null){textNum=1}
    else {textNum=getCookie("textNumCookie");
    textNum++;
    if (textNum > numTexts) textNum=1}
    saveCookie1y("textNumCookie",textNum,X1y);
    if (textNum==1){text=text1}
    if (textNum==2){text=text2}
    if (textNum==3){text=text3}
    if (textNum==4){text=text4}
    if (textNum==5){text=text5}

    // Results panel
    c+="<tr><td align=center colspan=3>";
    c+="<textarea name=results border=1 cols=48 rows="+High+">"+text+"</textarea>";
    c+="</td></tr>";

  • #2
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    looking at your code, i noticed the following:

    if (getCookie("textNumCookie")==null){textNum=1}
    else {textNum=getCookie("textNumCookie");

    notice the curly bracket ( '{' ). you have an opening bracket, but not a closing one. i'm guessing that has at least something to do with your problem.
    Last edited by joh6nn; 06-23-2002 at 01:52 PM.
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks, but the closing bracket } is down two lines.

    The line it appears on looks a little funny because it contains another if statement... one without any {}s because they aren't needed with a simple, one line if statement.

  • #4
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72 W. 48' 57" , 41 N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    hmm. then maybe if i could see the rest of the page this is on?
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #5
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Hi joh6nn,

    You should be able to see it here: http://nwwellness.com/cph/index.html

    Just keep clicking on Refresh and you will see it happen. I numbered the various versions of the <textarea> text to make the error easier to see.

    Then click on Fat Loss Tip, slide to the bottom of that page and click on Calculator, and you will see it change as it should.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    This is still driving my tired little brain nuts.

    I have put an alert message in just after writing the frame. It will display the correct text, which will actually display in the <textarea> in the background. Then when you click on OK, you will see the "ghost" text return.

    Variable "c" contains HTML/JS code to create the page:
    c=...
    c+="</td></tr></form></table></td></tr></table></center></body></html>";
    document.write(c);
    alert(document.f1.results.value);

    In addition, I have commented out all of my code which (within functions) changes the <textarea> so I don't see how I can be causing this.

    // xxx document.f1.results.value=Results;
    // xxx document.f1.results.value=text;
    // xxx document.f1.results.value=undoResults;

    The only place left that puts text into the <textarea> is when the page is created.

    // Results panel (part of form name=f1)
    c+="<tr><td align=center colspan=3>";
    c+="<textarea name=results border=1 cols=48 rows="+High+">"+text+"</textarea>";
    c+="</td></tr>";

    And it looks like this works fine as the correct text appears in the alert, and on the screen before the "ghost" text scares it away!


    http://nwwellness.com/cph/index.html

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    47
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi

    I had an idea just perusuing your post, so maybe we can assess this before proceeding:

    1) which browsers causes this problem (all or NS6/Mozilla & Opera?)
    2) has your textarea css style declarations? I ask for I stumbled into strange things made by textarea on the opera and netscape family as a consequence of style declarations.

    ciao
    Alberto http://www.unitedscripters.com/

  • #8
    Regular Coder
    Join Date
    Jun 2002
    Location
    Vancouver, WA
    Posts
    233
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Dear TrueLies,

    Just as you were posting I was trying other browsers. I think my orginal post suggested that it might have to do with that.

    The problem doesn't seem to occur with Netscape 6.2 or my WebTV simulator, just Internet Explorer. And I don't have the most recent version of that.

    I think I'm going to stop worrying about this now that it works with other browsers and... as I commented originally... it only fails when you Refresh over and over which a visitor will never do.

    It was a brain teaser. And a good one!


  •  

    Posting Permissions

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