IE 7 represents a newline as chr(13)&chr(10) - 2 bytes

and

FF 2 as chr(10) - 1 byte

<textarea>
0123456789
0123456789
0123456789
0123456789
</textarea>

Using the above data

IE gives: 40 chars + 4 Newlines * (2 chars) = 48 chars
FF gives: 40 chars + 4 Newlines * (1 char) = 44 chars

so all we need to do is remove the chr(13) from the string using the
following js

var text = document.getElementById('test').value;
newText = text.replace(/\n/g,'');

if you don't want to count the newlines at all then

newtext = text.replace(/\r|\n/g,'');

which will report 40 chars in IE and FF

Cheers,
Pete


On Apr 12, 6:49 am, "Taco Fleur" <[EMAIL PROTECTED]> wrote:
> Thanks Mark, that's really comforting that I am not alone.. but still have
> to search for a solution ;-)
>
> On 4/11/07, Mark Mandel <[EMAIL PROTECTED]> wrote:
>
>
>
> > Just so you know, I hit this bug also ages ago where the length given
> > by FF and the length given by IE were totally different.
>
> > I forget what the workaround was... but know that you aren't alone ;o)
>
> > Mark
>
> > --
> > E: [EMAIL PROTECTED]
> > W:www.compoundtheory.com
>
> --
> Taco Fleur -http://www.pacificfox.com.au
> Web Design, Web development, Graphic Design and Complete Internet Solutions
> an industry leader with commercial IT experience since 1994 ...


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"cfaussie" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cfaussie?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to