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

W

Wee

String.value.length 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=document.Formcalc.splitword.value;
document.writeln(myMessage);

var total_length=document.Formcalc.splitword.value.length;
document.writeln(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="JavaScript">

var userInput=new Array();

function CalcWord(){
var myMessage=document.Formcalc.splitword.value;
document.writeln(myMessage);

var total_length=document.Formcalc.splitword.value.length;
document.writeln(total_length); //missing here.

var code=myMessage.charCodeAt(6);
document.writeln(code);

var index2=myMessage.indexOf(" ");
document.writeln(index2);
}

</script>
</head>


<body>

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

</body>

</html>
 
R

Richard Cornford

Wee said:
String.value.length 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.
It works if I run only one of the statement above, but not both.
No such problem in Mozilla or Opera.
Bugs?

pls comment.
function CalcWord(){
var myMessage=document.Formcalc.splitword.value;
document.writeln(myMessage);

The first document.writln opens, clears and replaces the current
document.
var total_length=document.Formcalc.splitword.value.length;

So now there is no form and no textarea within it. ("document.Formcalc
is null or not an object")
document.writeln(total_length); //missing here.
<snip>

You are lucky if it works in any browser.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top