本文介绍了主页面不加载或引用jquery文件,即使那些jquery脚本在其他页面和用户控件上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我正在尝试在我的网站中实现滑块,我在usercontrol中创建的滑块。当我使用.aspx页面的控件时,它工作正常,但我在母版页中实现的控件不起作用。我在互联网上获得了一些帮助并使用了这个ResolveUrl < script src =' <%#ResolveUrl( 〜/脚本/ jquery-1.4.1.min.js)%> ' 类型 = text / javascript > < / script > 和脚本参考 < asp:ScriptManager ID = ScriptManager1 runat = server > < 脚本 > < asp:ScriptReference 路径 = / Scripts / jquery-1.4.1.min.js / > < / Scripts > 我有trie d但仍然是masterpage不引用jquery。 我从这个链接获得了这个代码http://www.c-sharpcorner.com/UploadFile/rohatash/jquery-image-slider-in-Asp-Net/ 我的代码: < script src =' <%#ResolveUrl( 〜/ Scripts / jquery-1.4.1.min。 js)%> ' 类型 = text / javascript > < / script > < link href = 样式/ nivo-slider.css rel = stylesheet type = text / css / > < ; link href = 样式/ Default.css rel = stylesheet type = text / css / > < link href = 样式/ nivo-slider.css rel = 样式表 type = text / css / > < script src =' <%#ResolveUrl( / Scripts / Demo.js)%> ' type = text / javascript > < / script > < div class = slider-wrapper theme-default > < div id = nivo -slider class = nivoSlider > < asp:图像 ID = Image0 ImageUrl = 〜/ Images / 1.jpg runat = server / > < asp:Image ID = Image3 ImageUrl = 〜/ Images / 2.jpg runat = server / > < asp:Image ID = Image2 ImageUrl = 〜/ Images /3.jpg\" runat = server / > < asp:Image ID = Image1 ImageUrl = 〜/ Images / 4.jpg runat = server / > < / div > < / div > < script 类型 = text / javascript > $(窗口).load(function(){ // $('#nivo-slider')。nivoSlider(); $('[id $ = nivo-slider]')。nivoSlider(); }); < / script > 请有人帮我解决这个问题。 提前致谢 解决方案 (窗口).load(function(){ / / ( '#NIVO滑块')nivoSlider(); ('[ID I am trying to implement slider in my website ,The slider I have created in usercontrol. When I use that control with .aspx page it works fine but the same control I have implemented in master page it does not work. I have got some help on internet and using this "ResolveUrl"<script src='<%# ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>' type="text/javascript"></script>and script reference<asp:ScriptManager ID="ScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Path="/Scripts/jquery-1.4.1.min.js" /></Scripts>I have tried but still masterpage does not refer jquery .I have got this code from this link "http://www.c-sharpcorner.com/UploadFile/rohatash/jquery-image-slider-in-Asp-Net/"My Code: <script src='<%# ResolveUrl("~/Scripts/jquery-1.4.1.min.js")%>' type="text/javascript"></script> <link href="Styles/nivo-slider.css" rel="stylesheet" type="text/css" /> <link href="Styles/Default.css" rel="stylesheet" type="text/css" /> <link href="Styles/nivo-slider.css" rel="stylesheet" type="text/css" /> <script src='<%# ResolveUrl("/Scripts/Demo.js")%>' type="text/javascript"></script> <div class="slider-wrapper theme-default"> <div id="nivo-slider" class="nivoSlider"> <asp:Image ID="Image0" ImageUrl="~/Images/1.jpg" runat="server" /> <asp:Image ID="Image3" ImageUrl="~/Images/2.jpg" runat="server" /> <asp:Image ID="Image2" ImageUrl="~/Images/3.jpg" runat="server" /> <asp:Image ID="Image1" ImageUrl="~/Images/4.jpg" runat="server" /> </div> </div> <script type="text/javascript"> $(window).load(function () { // $('#nivo-slider').nivoSlider(); $('[id$=nivo-slider]').nivoSlider(); }); </script> please somebody help me to come out of this problem.Thanks in advance 解决方案 (window).load(function () { //('#nivo-slider').nivoSlider();('[id 这篇关于主页面不加载或引用jquery文件,即使那些jquery脚本在其他页面和用户控件上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-30 01:28