如题
这个问题比较棘手,
在网上查找了比较多这样的资料,普遍网友认为不能实现,其实能不能答案是肯定的,
.net功能如此强大。昨天看了一个贴,说可以能用cookies来实现,想想也有道理,
就拿本网站的记录登录2周的功能,我估计就是拿cookies记录用户当前id信息,时间为2周,现在有一案例,等待高手<script language="JavaScript">
<!--
function bold(){
Qr=document.selection.createRange().text;
if(!Qr || document.selection.createRange().parentElement().name!='description')
{
txt=prompt('输入需要加粗的文字.','');
if(txt!=null && txt!='') document.form1.description.value+=''+txt+'';
}
else{
document.selection.createRange().text=''+document.selection.createRange().text+'';
document.selection.empty();
}
}
//-->
</script>
<input type="button" value="加粗" onclick="bold();" id="Button1" />
<textarea name="description" style="width: 436px; height: 296px">选中我,点击加粗 </textarea>
<br />
<asp:Label ID="a" runat="server" Text="Label"> </asp:Label>
<asp:TextBox ID="b" runat="server"> </asp:TextBox> </div>
</form> 现在加入一个服务端的button,如何使按下button后使得已经赋值的textarea的值发送个服务端???又或者让textarea的值赋给服务端能取的session,使用cookies??????等待
这个问题比较棘手,
在网上查找了比较多这样的资料,普遍网友认为不能实现,其实能不能答案是肯定的,
.net功能如此强大。昨天看了一个贴,说可以能用cookies来实现,想想也有道理,
就拿本网站的记录登录2周的功能,我估计就是拿cookies记录用户当前id信息,时间为2周,现在有一案例,等待高手<script language="JavaScript">
<!--
function bold(){
Qr=document.selection.createRange().text;
if(!Qr || document.selection.createRange().parentElement().name!='description')
{
txt=prompt('输入需要加粗的文字.','');
if(txt!=null && txt!='') document.form1.description.value+=''+txt+'';
}
else{
document.selection.createRange().text=''+document.selection.createRange().text+'';
document.selection.empty();
}
}
//-->
</script>
<input type="button" value="加粗" onclick="bold();" id="Button1" />
<textarea name="description" style="width: 436px; height: 296px">选中我,点击加粗 </textarea>
<br />
<asp:Label ID="a" runat="server" Text="Label"> </asp:Label>
<asp:TextBox ID="b" runat="server"> </asp:TextBox> </div>
</form> 现在加入一个服务端的button,如何使按下button后使得已经赋值的textarea的值发送个服务端???又或者让textarea的值赋给服务端能取的session,使用cookies??????等待
服务端使用description.value
任何HTML的控件,加上runat="server" id="%%%%"
就可以在.NET后台被访问了
讲任何绝对了,大部分吧。
CS:
这个bn的事件??不知是否?
<textarea id="description" runat="server" name="description" style="width: 436px; height: 296px">选中我,点击加粗 </textarea> protected void Button1_Click(object sender, EventArgs e)
{
string str=description.value;
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="showdiv.aspx.cs" Inherits="MyWebpractise.showdiv" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server"></asp:Label>
<textarea id="TextArea1" cols="20" rows="2" runat="server"></textarea>
<br />
<asp:Button ID="Button2" runat="server" Text="试试HTML控件"
onclick="Button2_Click" />
</form>
</body>
</html>protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = TextArea1.Value;
}
我亲自试过了。如果再不行的话
只能说你RP有问题了啊
同情楼主,一些人题目都没了解清楚就乱说!!!