问题描述
当我尝试使用大文本(例如,字符串长度为600000)设置textarea的值时,浏览器(Firefox 3.5.3)冻结。
文本在1行,所以文本包装需要由textarea本身发生。我认为这会导致这个问题。
有人知道这个问题的解决方法吗?
Firefox中的 textarea
的最大大小为64K(可能只有32K,我不记得)。 600,000个字符大于此值。如果您粘贴到 textarea
中的文本的大小实际上超过了该大小,则会有没什么可以做的。
当然,另一种方法是对进入现场的数据进行某种限制,然后给用户一些反馈,为什么他们的数据不适合。
When I try to set the value of a textarea with a large text (for example a string length of 600000), the browser (Firefox 3.5.3) freezes.
The text is in 1 line so text wrapping needs to happen by the textarea itself. I think this causes the problem.
Does anyone know a fix for this problem?
The maximum size for a textarea
in Firefox is 64K (it could be just 32K, I can't recall). 600,000 characters is larger than that. If the size of the text that you're pasting into the textarea
does in fact exceed that size, then there's nothing you can do about it.
Of course, one alternative would be to put some type of restriction on the data going into the field and then give the user some feedback as to why their data won't fit.
这篇关于TextArea中的大文本会冻结计算机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!