能不能在JavaScript脚本里实现,因为不想页面被刷新。请问一下怎么实现?
解决方案 »
- 急!log4net在WEB上配置是应该在哪写[assembly: log4net.Config.XmlConfigurator(Watch = true)]
- 在.cs页面,离开当前页面时应调用什么事件修改数据
- [砖家来看]站内会员短信ajax涮新未读提示,求大流量下性能方案
- 把VS2005的项目升级到VS2008,应用AJAX,失败,不知道是为什么?
- System.Data.SqlClient.SqlException: 对象名 'student' 无效
- ****************************高分求问卷调查的解决办法(请务必先看清楚具体问题)***************************
- 可怜我吧!急死了!运行等一切都正常?可就是不执行里面的语句?哪位仁兄救小弟!
- 新手,开发了一个网站,总是出现各种各样的怪问题,帮满看看?
- windows服务,自动抓屏
- 如何用C++写web程序!?
- 做了一个网站发布到IIS上出错 请教各位
- 关于方向按键的问题
<script>
function onvalue()
{
document.getElementById("Label1").value="修改后的值";
}
</script>
<script>
function onvalue()
{
document.getElementById("<%=Label1.ClientID%>").value="修改后的值";
}
</script>
{
document.getElementById("Label1").innerHTML=document.getElementById("<%=TextBox1.ClientID %>").value;
}HTML代码:<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>后台代码:protected void Page_Load(object sender, EventArgs e)
{
TextBox1.Attributes.Add("onblur", "changeText();");
}
<script>
function onvalue()
{
document.getElementById("<%=Lable1 %>").value="修改后的值";
}
</script>
cs代码
protected void Page_Load(object sender, EventArgs e)
{
Textbox.Attributes.Add("onblar", "onvalue()");
}
这样也不能实现
<input type="text" onblur="onvalue();" id="aaa" runat="server" /> <script>
function onvalue()
{
document.getElementById("Label1").innerHTML="修改后的值";
}
</script>
<script language="javascript">
var Lbl= '<%=Label.ClientID %>'
function hanshu()
{
Lblobj = document.getElementById(Lbl)
Lblobj.value = "你想改变的值"
}
</script>
HTML代码: <asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
<asp:Label ID="Label1" runat="server"
Text="Label" onblur="changeText();"> </asp:Label> 也行
这里要用innerHTML 用value不行,因为label在浏览器中解析为span,没有value
<script language=javascript>
function setvalue()
{
document.getElementById("<%=LabelUser.ClientID%>").value("Text")="";
}
</script>asp页面:
<asp:TextBox ID="UserNametxt" runat="server" Width="120px" style="margin-left:0px"></asp:TextBox>
<asp:Label ID="LabelUser" runat="server" ForeColor ="Red" Width="100px" ></asp:Label>
后台:
protected void Page_Load(object sender, EventArgs e)
{
UserNametxt.Attributes.Add("onblar", "setvalue()");
}
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<script>
function onvalue()
{
document.getElementById("Label1").innerHTML="修改后的值";
}
</script>
if (!Page.IsPostBack)
{
this.TextBox1.Attributes.Add("onblur", "getall()");
}
<asp:TextBox ID="UserNametxt" runat="server" Width="120px" style="margin-left:0px"> </asp:TextBox>
<asp:Label ID="LabelUser" runat="server" ForeColor ="Red" Width="100px" > </asp:Label>
脚本
<script language="javascript">
function setvalue()
{
document.getElementById('<%=LabelUser.ClientID%>').innerHTML="aaaaaaaaa";
}
</script>
后台
if (!Page.IsPostBack)
{
UserNametxt.Attributes.Add("onblur", "setvalue();");
}
//楼主请及时结贴。可以了。
<asp:TextBox ID="UserNametxt" runat="server" Width="120px" style="margin-left:0px"> </asp:TextBox>
<asp:Label ID="LabelUser" runat="server" ForeColor ="Red" Width="100px" > </asp:Label>
脚本
<script language="javascript">
function setvalue()
{
document.getElementById('<%=LabelUser.ClientID%>').innerHTML="aaaaaaaaa";
}
</script>
后台
if (!Page.IsPostBack)
{
UserNametxt.Attributes.Add("onblur", "setvalue();");
}
//楼主请及时结贴。可以了。
这样是正确的