asp.net同时调用JS和后台的无效的解决
如果js是个定时器,那么就不走后台
<asp:Button runat="server" type="button" Text="重新发送邮件" ID="btnReRendEmail" class="btn-defaut02"
OnClick="btnReRendEmail_Click" />
//重新发送邮箱事件
var waitTime = 50;
function reRendEmail() {
var btnRe = document.getElementById("btnReRendEmail");
if (waitTime == 0) {
btnRe.removeAttribute("disabled");
btnRe.value = "重新发送邮件";
waitTime = 50;
} else {
btnRe.setAttribute("disabled", true);
btnRe.setAttribute('value',waitTime + "秒后可以重新发送");
waitTime--;
setTimeout(function() {
reRendEmail();
},
1000)
}
}
解决方法是,先走后台,然后在后台执行完最后一个方法的时候调用前台的JS
ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>reRendEmail();</script>");
原理就是先后台,再前台
asp.net同时调用JS和后台的无效的解决的更多相关文章
- js中style.display=""无效的解决方法
本文实例讲述了js中style.display=""无效的解决方法.分享给大家供大家参考.具体解决方法如下: 一.问题描述: 在js中我们有时想动态的控制一个div显示或隐藏或更多 ...
- C#后台调用js方法无效果,未解决。
this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "", "<script> ...
- ASP.NET定时调用WebService 运行后台代码
效果: 通过在网站的Global.asax的Application_Start方法中 加入定时器 定时调用WebService 该WebService的一个方法 负责在后台 向数据库的某个表加入数据 ...
- ASP.NET前台JS与后台CS函数如何互相调用
摘要: 在实际的Web开发中,我们可能会常常遇到后台调用前台JS代码或者前台JS调用后台代码的情况.今天就把比较实用的前后台相互调用的方法总结出来和大家分享. 在实际的Web开发中,我们可能会常常遇到 ...
- <asp:Button点击查询后,调用js中函数展现加载圈
<div> <div id='paneloading' style='display:none;position:fixed;top:0px;left:0px;z-index:999 ...
- asp.net调用js方法
C#前台js调用后台代码 前台js <script type="text/javascript" language="javascript"> fu ...
- 【问题】Asp.net MVC 的cshtml页面中调用JS方法传递字符串变量参数
[问题]Asp.net MVC 的cshtml页面中调用JS方法传递字符串变量参数. [解决]直接对变量加引号,如: <button onclick="deleteProduct('@ ...
- SilverLight 页面后台方法XX.xaml.cs 创建JS,调用JS ,弹出提示框
1.Invoke和InvokeSelf [c-sharp] view plaincopy public partial class CreateJSDemo : UserControl { publi ...
- asp.net Ajax调用Aspx后台方法
Ajax调用的前提(以aspx文件为例:) 1.首先需要在aspx文件后台中引用using System.Web.Services; 2.需要调用的方法必须是公共的(public).静态的(stati ...
随机推荐
- hive函数总结-字符串函数
hive 查看函数: show functions; parse_url: parse_url(url, partToExtract[, key]) - extracts a part from a ...
- 关于(x&y)+((x^y)>>1)的探究
今天在程序员面试宝典上看到 int f(int x int y ) { return (x&y)+((x^y)>>1) } f(729,271) 结果为500 从式子中可以看出分为 ...
- cxiamge 使用静态库 vs2010
首先下载cxiamge,我使用的是cxiamge_702 下载地址:http://download.csdn.net/detail/xing_ping_1987/8085129 编译静态库 新建项目, ...
- No1_5.字符串的基本操作_Java学习笔记
import java.text.DecimalFormat; import java.text.NumberFormat; import java.util.Locale; import java. ...
- C# 获取当前路径
// 获取程序的基目录.System.AppDomain.CurrentDomain.BaseDirectory F:\广告编辑系统新\taxi_edit\taxi_form\bin\Debug\ ...
- symfony2 表单
正常情况下我还是更喜欢直接写表单而不是使用symfony内置的表单对象来穿件表单,但当我一个表单比较重要,需要csrf保护的时候 我会选择使用这种方法来表单. 官方文档有介绍一大堆通过类创建表单这里我 ...
- django删除migrations
先把migrations文件夹里面的数据删除. 删除数据库中关联的表 删除django_migrations里面关联的数据(因为在migrate的时候发现django_migrations表有相关数据 ...
- document.body.scrollTop vs document.documentElement.scrollTop && document.body.scrollHeight vs document.documentElement.scrollHeight
FireFox下 document.body.scrollHeight || document.documentElement.scrollHeight;//等价 document.body.scro ...
- cf A. Vasily the Bear and Triangle
http://codeforces.com/contest/336/problem/A #include <cstdio> #include <cstring> #includ ...
- BZOJ 1927 星际竞速
http://www.lydsy.com/JudgeOnline/problem.php?id=1927 思路:把一个点拆成两个点, S->i 费用0,流量1 (代表这个点可以移动到其他点所必备 ...