By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,381 Members | 1,641 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,381 IT Pros & Developers. It's quick & easy.

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

P: n/a
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.len gth;
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.len gth;
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>
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Wee" <wt****@hotmail.com> wrote in message
news:3f**********@news.tm.net.my...
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. <snip> It works if I run only one of the statement above, but not both.
No such problem in Mozilla or Opera.
Bugs?

pls comment. <snip> 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.len gth;
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.
Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.