从code-背后显示DIV传递文本 [英] displaying div passing text from code-behind

查看:86
本文介绍了从code-背后显示DIV传递文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何通过短信与该功能显示在DIV相处?从code后面

 < D​​IV CLASS =成功ID =divStatus=服务器可见=假>< / DIV>
。Page.ClientScript.RegisterStartupScript(this.GetType(),somekey,自动隐藏功能(){setTimeout的(函数(){document.getlementById('+ divStatus.ClientID +')的style.display ='无'; },5000);};,真);


解决方案

您可以这样做:

 字符串脚本= @的document.getElementById('+ divStatus.ClientID +').innerHTML ='你完成了! ;的setTimeout(函数(){的document.getElementById('+ divStatus.ClientID +').style.display ='无';},5000);;
 Page.ClientScript.RegisterStartupScript(this.GetType(),somekey,脚本,真);

的影响将是:更改divStatus div的内部HTML说你完成了,然后将在5秒钟后消失在div

how to pass the text message along with this function to display on the div? from code behind

 <div class="success" id="divStatus" runat="server" visible="false" ></div>


Page.ClientScript.RegisterStartupScript(this.GetType(),"somekey","function autoHide(){ setTimeout(function() {document.getlementById('"+divStatus.ClientID+"').style.display='none';},5000);};",true);

解决方案

You can do this:

 string script = @"document.getElementById('" + divStatus.ClientID + "').innerHTML='You are done!' ;setTimeout(function(){document.getElementById('" + divStatus.ClientID + "').style.display='none';},5000);";
 Page.ClientScript.RegisterStartupScript(this.GetType(), "somekey", script, true);

The effect will be: Change the inner HTML of the divStatus div to say "You are done" and then it will disappear the div after 5 seconds.

这篇关于从code-背后显示DIV传递文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆