jquery不在asp.net的母版页上工作 [英] jquery is not working on master page in asp.net

查看:65
本文介绍了jquery不在asp.net的母版页上工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的主页上有以下代码,用于标题标签母版页中的autocomplte文本框

 <   script     src   ='  <% = Page.ResolveUrl(  ~http://code.jquery.com/jquery-1.9.1.js%> ' >  <   / script  >  

< script src =' < ;% = Page.ResolveUrl( ~http://code.jquery.com/ui/1.10 .3 / jquery-ui.js%> ' > < / script >
< link < span class =code-attribute> rel = stylesheet href =' <% = Page.ResolveUrl( http: //code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css\")%> ' / >


< link rel = stylesheet href = /resources/demos/style.css / >

< script < span class =code-keyword>>

$(function(){

var availableTags = [

ActionScript,

AppleScript,

Asp,

BASIC,

C ,

C ++,

Clojure,

COBOL,

ColdFusion,

Erlang,

Fortran,

Groovy,

Haskell,

Java,

JavaScript,

Lisp,

Perl,

PHP ,

Python,

Ruby,

Scala,

计划

];

$(#tags)。autocomplete({

source:availableTags

});

});

< / script >



这是我的正文代码

< 
< asp:TextBox ID = tags runat = server高度= 20px style = padding-top:0px
宽度= 313px> < / asp:TextBox >
asp:ImageButton ID = searchimg_btn runat = server高度= 26px宽度= 86px
ImageUrl = 〜/ Images / search.jpg onclick = searchimg_btn_Click />



此代码在简单的aspx页面中运行良好,但这不适用于母版页

解决方案

(function(){

var availableTags = [

ActionScript,

AppleScript,

Asp,

BASIC,

C,

C ++,

Clojure,

COBOL,

ColdFusion,

Erlang,

Fortran,

Groovy,

Haskell,

Java,

JavaScript ,

Lisp,

Perl,

PHP,

Python,

Ruby,

Scala,

方案

];


(#标签)。自动完成({

来源:availableTags

});

});

< / script >



这是我的正文代码

< 
< asp:TextBox ID = tags runat = server高度= 20px style = padding-top:0px
宽度= 313px> < / asp:TextBox >
asp:ImageButton ID = searchimg_btn runat = server高度= 26px宽度= 86px
ImageUrl = 〜/ Images / search.jpg onclick = searchimg_btn_Click />



此代码在简单的aspx页面中运行良好,但这不适用于母版页


访问在这个页面..



http:// www .dotnetcurry.com / ShowArticle.aspx?ID = 669 [ ^ ]









< a href =http://www.dotnetcurry.com/ShowArticle.aspx?ID=310> http://www.dotnetcurry.com/ShowArticle.aspx?ID=310 [ ^ ]


i have below code on my master page for autocomplte text box in master page in header tag

<script src='<%=Page.ResolveUrl("~http://code.jquery.com/jquery-1.9.1.js")%>'></script>

  <script src='<%=Page.ResolveUrl("~http://code.jquery.com/ui/1.10.3/jquery-ui.js") %>'></script>
   <link rel="stylesheet" href='<%=Page.ResolveUrl("http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css")%>' />


  <link rel="stylesheet" href="/resources/demos/style.css" />

  <script>

      $(function () {

          var availableTags = [

      "ActionScript",

      "AppleScript",

      "Asp",

      "BASIC",

      "C",

      "C++",

      "Clojure",

      "COBOL",

      "ColdFusion",

      "Erlang",

      "Fortran",

      "Groovy",

      "Haskell",

      "Java",

      "JavaScript",

      "Lisp",

      "Perl",

      "PHP",

      "Python",

      "Ruby",

      "Scala",

      "Scheme"

    ];

          $("#tags").autocomplete({

              source: availableTags

          });

      });

  </script>


and this is my body code

<
<asp:TextBox ID="tags" runat="server" Height="20px" style="padding-top: 0px" 
            Width="313px"></asp:TextBox>
asp:ImageButton ID="searchimg_btn" runat="server" Height="26px" Width="86px"
                   ImageUrl="~/Images/search.jpg" onclick="searchimg_btn_Click" />


this code is running well in simple aspx page but this is not working on master page

解决方案

(function () { var availableTags = [ "ActionScript", "AppleScript", "Asp", "BASIC", "C", "C++", "Clojure", "COBOL", "ColdFusion", "Erlang", "Fortran", "Groovy", "Haskell", "Java", "JavaScript", "Lisp", "Perl", "PHP", "Python", "Ruby", "Scala", "Scheme" ];


("#tags").autocomplete({ source: availableTags }); }); </script>


and this is my body code

<
<asp:TextBox ID="tags" runat="server" Height="20px" style="padding-top: 0px" 
            Width="313px"></asp:TextBox>
asp:ImageButton ID="searchimg_btn" runat="server" Height="26px" Width="86px"
                   ImageUrl="~/Images/search.jpg" onclick="searchimg_btn_Click" />


this code is running well in simple aspx page but this is not working on master page


visit on this page..

http://www.dotnetcurry.com/ShowArticle.aspx?ID=669[^]

or


http://www.dotnetcurry.com/ShowArticle.aspx?ID=310[^]


这篇关于jquery不在asp.net的母版页上工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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