textbox 中可输入很多字符。当我用鼠标选定某些字符时,在提交后如何获得我选定的那些字符????
解决方案 »
- 请问Delphi的TComponent大概相当于C#的哪一个类?
- 如何获得flash文件中的数据?
- 在掌上电脑中,假如已经跳转到其它窗口,怎么跳转回主窗口?
- 控制richtextbox中的图片大小
- 求方案
- 在ListView里怎样获得从DataSet里的数据????
- 请问大家我要在.NET中做一个TEXTBOX控件有文字滚动功能,并且,当我点及文字它会联接到一个网站。
- 大家好,请教一个ActiveX的问题
- 一个关于vs2003挺奇怪的问题,不知道大家碰到过没有
- 请教,id=fos@#sun,Request.QueryString["id"]执行后取出的值为"fos@","#"后面的全部被截去了,请问怎么解决,谢谢。
- 如何在winform程序中向某个站点发送POST数据,实现用户的注册?
- 问题没有解决急需问!
C#代码如下,已经在VS2005环境下运行通过:if (textBox1.SelectedText.Length == 0)
{
MessageBox.Show("请先选择字符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
textBox2.Text = textBox1.SelectedText.Trim();
int index = TextBox.SelectionStart;
string s= TextBox.Text;
s= s.Substring(0, index + str.Length - 1);
{
if (textBox1.SelectedText.Length == 0)
{
MessageBox.Show("请先选择字符", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
textBox2.Text = textBox1.SelectedText.Trim();
}
<head runat="server">
<title></title>
<script language=javascript>
function getSelText() {
var txt = '';
if (window.getSelection) {
txt = window.getSelection();
}
else if (document.getSelection) {
txt = document.getSelection();
}
else if (document.selection) {
txt = document.selection.createRange().text;
}
else return;
//document.getElementById(selectedtext).value = txt;
alert(txt);
}
</script>
</head>
<body>
<form name=aform >
<input type="button" value="Get selection" onmousedown="getSelText()">
<textarea name="selectedtext" rows="5" cols="20"></textarea>
</form>
</body>
</html>