Jquery不在内容页面中使用C#ASP.NET Web表单 [英] Jquery is not working C# ASP.NET web form not in content page

查看:73
本文介绍了Jquery不在内容页面中使用C#ASP.NET Web表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本在计时器的'onload'事件上运行section标签。它正在使用内容页面,但它不能与webform一起使用,任何人都可以建议我这个。



此计时器已在单独的javascript文件中完成



我的尝试:



I have a script to run section tag on 'onload' event for timer. It is working with content page but it is not working with the webform can anyone suggest me with this.

This timer has done in separate javascript file

What I have tried:

<script src="../Scripts/jquery-3.3.1.js"></script>
<script src="../Scripts/jquery-3.3.1.min.js"></script>
<script src="../Scripts/countdown.js"></script>
<script type="text/javascript">
    $(function () {
        $('section[onload]').trigger('onload');
    });
</script>



这些脚本添加在head标签中,而不是在正文的结束标签中。




These scripts added in head tag not in closing tag of body.

<section style="width:20%;float:left;height:318px;margin:20px;position:fixed;" onload="startTimer()">
    <div class="timer"></div>
</section>





此startTimer()方法用countdown.js文件编写。此文件在主内容页面中工作,但在webform中不起作用。如何实现这个



This startTimer() method is written in countdown.js file. This file is working in master content page but not in webform. How to achieve this

推荐答案

(function(){
(function () {


('section [onload]')。trigger('onload ');
});
< / script>
('section[onload]').trigger('onload'); }); </script>



这些脚本添加在head标签中,而不是在正文的结束标签中。




These scripts added in head tag not in closing tag of body.

<section style="width:20%;float:left;height:318px;margin:20px;position:fixed;" onload="startTimer()">
    <div class="timer"></div>
</section>





此startTimer()方法用countdown.js文件编写。此文件在主内容页面中工作,但在webform中不起作用。如何实现这个



This startTimer() method is written in countdown.js file. This file is working in master content page but not in webform. How to achieve this


这篇关于Jquery不在内容页面中使用C#ASP.NET Web表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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