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 ...
随机推荐
- Android下按钮的使用方法
package com.hangsheng.button; import android.app.Activity; import android.os.Bundle; import android. ...
- QML添加右键菜单
MouseArea { id: mouseRegion anchors.fill: parent; acceptedButtons: Qt.LeftButton | Qt.RightButton // ...
- (原)torch中显示nn.Sequential()网络的详细情况
转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6065526.html 本部分多试几次就可以弄得清每一层具体怎么访问了. step1. 网络定义如下: ...
- SQL学习笔记——SQL中的数据查询语句汇总
where条件表达式 --统计函数 Select count(1) from student; --like模糊查询 --统计班上姓张的人数 select count(*) from student ...
- UVa10651(记忆化搜索)
题意: 给一串-和o组成的字符串,你可以把“-oo"变成”o--",可以把“oo-”变成“--o",问最后最少有多少个o. 状态压缩 ,记忆化搜索 code: #incl ...
- php array_combine 把array的默认键改成指定的字符串
array(2) { [0] => array(6) { [0] => string(1) "1" [1] => string(10) "1470650 ...
- python3.5读取网页代码,并保存
在旧版的python中有个urllib模块,内有一个urlopen方法可打开网页,但新版python中没有了,新版的urllib模块里面只有4个子模块(error,request,response,p ...
- 排队论的C实现
大家好,我是小鸭酱,博客地址为:http://www.cnblogs.com/xiaoyajiang 以下鄙人实现了排队论思想,语言是C语言 #include<stdio.h> #in ...
- C# LinkButton 带参数的OnCommand事件的写法
前台: <asp:TemplateField HeaderText ="操作"> <HeaderStyle HorizontalAlign ="Cent ...
- Android的init过程详解(一)(转)
本文使用的软件版本 Android:4.2.2 Linux内核:3.1.10 本文及后续几篇文章将对Android的初始化(init)过程进行详细地.剥丝抽茧式地分析,并且在其中穿插了大量的知识,希望 ...