赋值的textarea能分行显示吗? 我用\r\n试了,textarea里的内容都显示不出来了,我的textarea是放在DIV里的 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果sSBInfo放在<textarea></textarea>中间则\r\n能换行,即<textarea>"+sSBInfo+"</textarea>方式,但是我的sSBInfo是放在<textarea onmousemove=\"this.value='"+sSBInfo+"';\" > </textarea>处,用\r\n则会出现网页错误,而用<br>也不行 <html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"> <title>无标题页</title> <script type="text/javascript"> function mouseover() { var str="sdfsd\r\nsdfsfds"; document.getElementById("TextArea1").value=str; } </script></head><body> <form id="form1" runat="server"> <div> <textarea id="TextArea1" runat="server" cols="20" rows="2" onmouseover="mouseover()"></textarea> </div> </form></body></html> <pre><textarea> </textarea></pre>这样试下 如果我的代码写在JS里6楼的方法可以,可是我的代码是写在.cs文件里的,而sSBInfo=str1+"\r\n"+str2;放在<textarea onmousemove="+sSBInfo+"></textarea>会出现网页错误 这样可以显示: string strInfo = "test1" + "" + "test2"; int m = 10; int n = 10; aa = "<div style=\"LEFT:" + m + "px;TOP:" + n + "px;POSITION: absolute;VISIBILITY: visible;\"> <textarea id=\"TextArea2\" runat=\"server\" style=\"VISIBILITY: visible;width:150px;height:80px;\" onmousemove=\"mouseover('" + strInfo + "')\" > </textarea> </div>"; Label1.Text = aa;------------------------------------------------- <script type="text/javascript"> function mouseover() { var str="sdfsd\r\nsdfsfds"; document.getElementById("TextArea2").value=str; } </script> 这样也可以显示: string strInfo = "test1" + "@" + "test2"; int m = 10; int n = 10; aa = "<div style=\"LEFT:" + m + "px;TOP:" + n + "px;POSITION: absolute;VISIBILITY: visible;\"> <textarea id=\"TextArea2\" runat=\"server\" style=\"VISIBILITY: visible;width:150px;height:80px;\" wrap=\"hard\" onmousemove=\"mouseover('" + strInfo + "')\" > </textarea> </div>"; Label1.Text = aa;----------------------------------------- function mouseover(t) { t=t.replace('@','\r\n'); document.getElementById("TextArea2").value=t; } </script> @代表什么啊,如果string strInfo = "test1" + "@" + "test2"+"@" + "test3"; 则只有test1 和test2能换行,test2和test3不能换行@会显示出来 为什么加了空格显示方式就完全不同呢 二级导航 这功能如何用JS写 javascript 递归中断问题,请教高手 javascript继承不理解 问一个很难很难的问题 点页面右上角那个"X"时能不能弹出一个确认对话框? 求助 如何使tab获得焦点竖直排列 怎样检测客户端的Office安装路径 如何理解这段窗口载入程序? html 标签字符串用正则表达式替换的问题? 小问题: 如果把这个效果写进Js文件, 到时html只管调用js,要怎么写? 速度结帖!!
但是我的sSBInfo是放在<textarea onmousemove=\"this.value='"+sSBInfo+"';\" > </textarea>处,用\r\n则会出现网页错误,而用<br>也不行
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>无标题页</title>
<script type="text/javascript">
function mouseover()
{
var str="sdfsd\r\nsdfsfds";
document.getElementById("TextArea1").value=str;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<textarea id="TextArea1" runat="server" cols="20" rows="2" onmouseover="mouseover()"></textarea>
</div>
</form>
</body>
</html>
这样试下
string strInfo = "test1" + "" + "test2";
int m = 10;
int n = 10;
aa = "<div style=\"LEFT:" + m + "px;TOP:" + n + "px;POSITION: absolute;VISIBILITY: visible;\"> <textarea id=\"TextArea2\" runat=\"server\" style=\"VISIBILITY: visible;width:150px;height:80px;\" onmousemove=\"mouseover('" + strInfo + "')\" > </textarea> </div>";
Label1.Text = aa;
------------------------------------------------- <script type="text/javascript">
function mouseover()
{
var str="sdfsd\r\nsdfsfds";
document.getElementById("TextArea2").value=str;
}
</script>
string strInfo = "test1" + "@" + "test2";
int m = 10;
int n = 10;
aa = "<div style=\"LEFT:" + m + "px;TOP:" + n + "px;POSITION: absolute;VISIBILITY: visible;\"> <textarea id=\"TextArea2\" runat=\"server\" style=\"VISIBILITY: visible;width:150px;height:80px;\" wrap=\"hard\" onmousemove=\"mouseover('" + strInfo + "')\" > </textarea> </div>";
Label1.Text = aa;-----------------------------------------
function mouseover(t)
{
t=t.replace('@','\r\n');
document.getElementById("TextArea2").value=t;
}
</script>
@代表什么啊,如果string strInfo = "test1" + "@" + "test2"+"@" + "test3"; 则只有test1 和test2能换行,test2和test3不能换行@会显示出来