textarea中源文件的“汉字”是乱码!怎么办啊?搞了一上午了,大侠帮我!!!
1.<br>
<textarea id=text1 style="width: 90%; height: 50%">啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺</textarea><br>
2.<br>
<input id=inpu2 onclick=f_inpu2() type=button value="search 0-3754">
<input id=inpu2a><br>
<iframe id=ifra2 src="about:" width=90% height=50%></iframe><br>
3.<br>
<input id=inpu3 onclick=f_text3() type=button value="source"><br>
<textarea id=text3 style="width: 90%; height: 50%"></textarea><br>
<script>
///////////////////////////// user function //////////////////////////////////
function f_inpu2()
{
tmpsrc='<iframe id=ifra2 src="http://www1.baidu.com/baidu?word='+text1.value.charAt(inpu2a.value)+'"width=90% height=50%></iframe>' //prepare the search char
document.all.ifra2.outerHTML=tmpsrc //run search
inpu2a.value++ //prepare next search
}
function f_text3()
{
text3.value=loadContent(document.getElementById("ifra2").src) //put source to text3
}
function loadContent(strURL) //I get this code from a friend (used for "function f_text3()")
{
var strContent = "";
if (typeof strURL != "string" || strURL == "")return strContent;
try
{
var oProxy = new ActiveXObject("Microsoft.XMLHTTP");
oProxy["Open"]("GET", strURL, false);
oProxy["Send"]();
strContent = oProxy["responseText"];
}
catch(e){status = e.description}
return strContent;
}
</script>
<script>
///////////////////////////// system function /////////////////////////////////
function window.onload()
{
inpu2a.value=0 //set init is null
}
</script>
<textarea id=text1 style="width: 90%; height: 50%">啊阿埃挨哎唉哀皑癌蔼矮艾碍爱隘鞍氨安俺按暗岸胺</textarea><br>
2.<br>
<input id=inpu2 onclick=f_inpu2() type=button value="search 0-3754">
<input id=inpu2a><br>
<iframe id=ifra2 src="about:" width=90% height=50%></iframe><br>
3.<br>
<input id=inpu3 onclick=f_text3() type=button value="source"><br>
<textarea id=text3 style="width: 90%; height: 50%"></textarea><br>
<script>
///////////////////////////// user function //////////////////////////////////
function f_inpu2()
{
tmpsrc='<iframe id=ifra2 src="http://www1.baidu.com/baidu?word='+text1.value.charAt(inpu2a.value)+'"width=90% height=50%></iframe>' //prepare the search char
document.all.ifra2.outerHTML=tmpsrc //run search
inpu2a.value++ //prepare next search
}
function f_text3()
{
text3.value=loadContent(document.getElementById("ifra2").src) //put source to text3
}
function loadContent(strURL) //I get this code from a friend (used for "function f_text3()")
{
var strContent = "";
if (typeof strURL != "string" || strURL == "")return strContent;
try
{
var oProxy = new ActiveXObject("Microsoft.XMLHTTP");
oProxy["Open"]("GET", strURL, false);
oProxy["Send"]();
strContent = oProxy["responseText"];
}
catch(e){status = e.description}
return strContent;
}
</script>
<script>
///////////////////////////// system function /////////////////////////////////
function window.onload()
{
inpu2a.value=0 //set init is null
}
</script>
...全文
相关推荐
JSP获取TextArea中的值
此外,为了防止编码问题,例如中文乱码,需要设置请求和响应的字符集。
swing中文乱码问题(Linux和window)
例如,设置JTextArea的字体为支持中文的字体:```javaJTextArea textArea = new JTextArea();textArea.setFont(new Font("宋体",
jsp实现textarea中的文字保存换行空格存到数据库的方法
此外,为了防止字符编码问题,在处理请求之前,我们应设置请求的字符编码为"utf-8",以确保中文字符等能够正确地被处理和存储。
Javaweb接收表单数据并处理中文乱码
value="大二">大二</option><option value="大三">大三</option><option value="大四">大四</option></select>对于textarea
swing英文版xp乱码问题解决
例如,使用`new String(bytes, "UTF-8")`进行解码。通过以上方法,一般可以有效地解决Swing在英文版XP系统上的乱码问题。


