String.value and String.value.length doesn't works together in IE with JVM

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wee

    String.value and String.value.length doesn't works together in IE with JVM

    String.value.le ngth and String.value doesn't work together in a single
    function in IE. I've no problem running either of this, but not together at
    the same time.

    var myMessage=docum ent.Formcalc.sp litword.value;
    document.writel n(myMessage);

    var total_length=do cument.Formcalc .splitword.valu e.length;
    document.writel n(total_length) ; //missing here.

    It works if I run only one of the statement above, but not both. No such
    problem in Mozilla or Opera.
    Bugs?

    pls comment.
    -------
    <?xml version="1.0"?>

    <html xmlns="http://www.w3.org/1999/xhtml">

    <head>

    <script type="text/javascript" language="JavaS cript">

    var userInput=new Array();

    function CalcWord(){
    var myMessage=docum ent.Formcalc.sp litword.value;
    document.writel n(myMessage);

    var total_length=do cument.Formcalc .splitword.valu e.length;
    document.writel n(total_length) ; //missing here.

    var code=myMessage. charCodeAt(6);
    document.writel n(code);

    var index2=myMessag e.indexOf(" ");
    document.writel n(index2);
    }

    </script>
    </head>


    <body>

    <FORM name="Formcalc" >
    <textarea rows="10" cols="40" name="splitword ">Please Type here </textarea>
    <input type="button" value="Calculat e" name="Calculate " onclick="CalcWo rd()"
    />
    </FORM>

    </body>

    </html>


  • Richard Cornford

    #2
    Re: String.value and String.value.le ngth doesn't works together in IE with JVM

    "Wee" <wterng@hotmail .com> wrote in message
    news:3f153be4$1 _2@news.tm.net. my...[color=blue]
    > String.value.le ngth and String.value doesn't work together in
    >a single function in IE. I've no problem running either of this,
    >but not together at the same time.[/color]
    <snip>[color=blue]
    > It works if I run only one of the statement above, but not both.
    >No such problem in Mozilla or Opera.
    > Bugs?
    >
    > pls comment.[/color]
    <snip>[color=blue]
    > function CalcWord(){
    > var myMessage=docum ent.Formcalc.sp litword.value;
    > document.writel n(myMessage);[/color]

    The first document.writln opens, clears and replaces the current
    document.
    [color=blue]
    > var total_length=do cument.Formcalc .splitword.valu e.length;[/color]

    So now there is no form and no textarea within it. ("document.Form calc
    is null or not an object")
    [color=blue]
    > document.writel n(total_length) ; //missing here.[/color]
    <snip>

    You are lucky if it works in any browser.

    Richard.


    Comment

    Working...