本文介绍了无法从asp.net中的javascript调用函数后面的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 < script type = text / javascript language = javascript> var tim; var min = 1 ; var sec = 60 ; var f = new 日期(); function f1(){ f2(); document .getElementById( starttime).innerHTML = 您的考试开始于 + f.getHours()+ : + f.getMinutes(); document .getElementById( endtime)。innerHTML = 您的时间是: + f.toLocaleTimeString( ); } function f2(){ if ( parseInt函数(秒)> 0 ){秒= parseInt (秒) - 1 ; 文档 .getElementById( 传送时间).innerHTML = 你的左手时间是: + min + 分钟, + sec + Seconds; tim = setTimeout( f2(), 1000 ); } 其他 { 如果( parseInt函数(秒)== 0 ){ MIN = parseInt函数(min) - 1 ; if ( parseInt (min)== 0 ){ clearTimeout(tim); document .getElementById(' 则myButton')点击(); alert( call); } 其他 { sec = 60 ; document .getElementById( showtime).innerHTML = 你的左手时间是: + min + 分钟, + sec + Seconds; tim = setTimeout( f2(), 1000 ); } } } } < / script> 我的整个代码在更新面板中。 这是一个模态弹出窗口 这是我的javascript代码.... mybtn是其内部面板的按钮。我想在计时器停止时调用它的click事件或任何公共void函数。解决方案 Hello Betu, 请参阅 __doPostBack功能 [ ^ ]本网站提供的文章。 问候, <script type="text/javascript" language ="javascript" > var tim; var min = 1; var sec = 60; var f = new Date(); function f1() { f2(); document.getElementById("starttime").innerHTML = "Your started your Exam at " + f.getHours() + ":" + f.getMinutes(); document.getElementById("endtime").innerHTML = "Your time is :" + f.toLocaleTimeString(); } function f2() { if (parseInt(sec) > 0) { sec = parseInt(sec) - 1; document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds"; tim = setTimeout("f2()", 1000); } else { if (parseInt(sec) == 0) { min = parseInt(min) - 1; if (parseInt(min) == 0) { clearTimeout(tim); document.getElementById('mybutton').click(); alert("calling"); } else { sec = 60; document.getElementById("showtime").innerHTML = "Your Left Time is :" + min + " Minutes ," + sec + " Seconds"; tim = setTimeout("f2()", 1000); } } } } </script>my whole code is in update panel. and this is a modal popup windowthis is my javascript code....mybtn is the button its inside panel. I want to call its click event or any public void function when timer stops. 解决方案 Hello Betu,Please refer to __doPostBack function[^] article available on this site.Regards, 这篇关于无法从asp.net中的javascript调用函数后面的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
09-27 14:45