用户控件无法在我的js文件中执行js方法 [英] User Control can't execute js methodes in my js file

查看:58
本文介绍了用户控件无法在我的js文件中执行js方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,我的朋友们.
我在这里有一个包含js文件的页面,它工作正常,我用它来动态制作其大小的动画div.但是问题是当我使用户控件无法正常工作时,这意味着我的jquery代码变得无法使用并且无法为与Div相关的动画设置.
感谢您的关注.这是我页面的代码:

 <%@    页面   语言  ="  C#"  AutoEventWireup    true"  CodeFile   ="  继承   ArticelCtrl"   %> 


<  !DOCTYPE     html     PUBLIC    -//W3C//DTD   XHTML     1.0    过渡//EN" " http://www.w3. org/TR/xhtml1/DTD/xhtml1-transitional.dtd" <   html     ="   http://www.w3.org/1999/xhtml" > 
<      ="  服务器" <  标题 >  <  /title  > 

    <  链接    ="   App_Themes/Theme1/91-05-16/CSS/StyleSheet. css"  rel   样式表" 类型  ="    > 
    <  脚本    ="   App_Themes/Theme1/91-05-16/Script/jquery- 1.6.js" 类型  文本/javascript" "><  / 脚本 > 
<  脚本    ="  文本/javascript" > 
    $(文档).ready(函数(){
  
         var  h =($(" ).innerHeight()+  50 )+ " ;
         var  p = $(" ).innerHeight();
        &  400 吗? p = p +  600 :p = p +  400 ;
        
        $(" ).toggle(> function (){
            $(" ).attr("  src"  App_Themes/Theme1/91 -05-16/Images/Icons/Close.png");
            $(" ).attr(" 标题" 关闭");
            $(" ).animate({opacity:" }, 100 );
            $(" ).animate({height:h},p);
        },功能(){
            $(" ).attr("  src"  App_Themes/Theme1/91 -05-16/Images/Icons/Open.png");
            $(" ).attr(" 标题" 更多");
            $(" ).animate({height:" },p);
            $(" ).show();
            $(" ).animate({opacity:" }, 1000 );
        });
        $(" ).mouseenter(> function (){
            $(" ).animate({width:" ,高度:" }," ).mouseleave(> function (){
            $(" ).animate({width:" ,高度:" },<  / 脚本 > 
<  /head  > 
<  正文 > 
    <  表单    ="   form1"  runat   >服务器"  > 
    <   div  > 
            <   div     ="   AnimatedArticleDiv"    AnimatedArticleDiv" > 
            <   div     ="  已删除边距6px;" > 
                <   asp:Label     ID   ="   runat   服务器" 文本  文章标题" 样式  ="  >  <  /asp:Label  > 
            <  /div  > 
            <   div     ="   padding:10px 10px 10px 10px;" > 
                <   asp:Label     ID   ="   runat   服务器" 样式   direction:rtl;" 
                                 文本  ="  >  <  /asp:Label  > 
            <  /div  > 
            <   asp:ImageButton     ID   ="   runat   服务器" 
 
                             样式   position:absolute; left:13px; bottom:2px; z-index:900;" 
 
                              ImageUrl   〜/App_Themes/Theme1/91-05-16/Images/Icons/Open.png" 工具提示  更多"   / > 
                <   div     ="   DotDiv" 样式  已删除:绝对;; remove8px; removed0; background-color:#DFFFEA; color:#003300; padding:0 2px 5px 30px;" <  /div  > 
            <  /div  > 
        <  /div  > 
    <  /form  > 
<  /body  > 
<  /html  >  


解决方案

(文档).ready(功能(){ var h =(


(" ).innerHeight()+ 50 )+ " px"; var p =


(" ).innerHeight(); & 400 吗? p = p + 600 :p = p + 400 ;


Hello my friends.
I have a page here that include a js file and it works fine, i used it for make an animated div for its size dynamically. but the problem is when i make a user control it doesn''t work, means my jquery codes becomes unusable and cant animate related Div.
Thanks for your attention. this is code of my page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ArticelCtrl.aspx.cs" Inherits="ArticelCtrl" %>


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <link href="App_Themes/Theme1/91-05-16/CSS/StyleSheet.css" rel="stylesheet" type="text/css" />
    <script src="App_Themes/Theme1/91-05-16/Script/jquery-1.6.js" type="text/javascript"></script>
<script type="text/javascript" >
    $(document).ready(function () {
  
        var h = ($("#AbstractText").innerHeight() + 50) + "px";
        var p = $("#AbstractText").innerHeight();
        p > 400 ? p = p + 600 : p = p + 400;
        
        $("#OpenCloseButton").toggle(function () {
            $("#OpenCloseButton").attr("src", "App_Themes/Theme1/91-05-16/Images/Icons/Close.png");
            $("#OpenCloseButton").attr("title", "Close");
            $("#DotDiv").animate({ opacity: "0" }, 100);
            $("#AnimatedArticleDiv").animate({ height: h }, p);
        }, function () {
            $("#OpenCloseButton").attr("src", "App_Themes/Theme1/91-05-16/Images/Icons/Open.png");
            $("#OpenCloseButton").attr("title", "More");
            $("#AnimatedArticleDiv").animate({ height: "66px" }, p);
            $("#DotDiv").show();
            $("#DotDiv").animate({ opacity: "1" }, 1000);
        });
        $("#OpenCloseButton").mouseenter(function () {
            $("#OpenCloseButton").animate({ width: "22px", height: "22px" }, 100);
        });
        $("#OpenCloseButton").mouseleave(function () {
            $("#OpenCloseButton").animate({ width: "20px", height: "20px" }, 150);
        });
    });
</script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
            <div id="AnimatedArticleDiv" class="AnimatedArticleDiv">
            <div style="margin-removed-6px;">
                <asp:Label ID="AbstractHeader" runat="server" Text="Article title" style="direction:rtl;"></asp:Label>
            </div>
            <div style="padding:10px 10px 10px 10px;">
                <asp:Label ID="AbstractText" runat="server" style="direction:rtl;"

                    Text="Some text are here"></asp:Label>
            </div>
            <asp:ImageButton ID="OpenCloseButton" runat="server" 

                style="position:absolute; left:13px; bottom:2px;z-index:900;" 

                ImageUrl="~/App_Themes/Theme1/91-05-16/Images/Icons/Open.png" ToolTip="More" />
                <div id="DotDiv" style="removed:absolute; removed8px;removed0;background-color: #DFFFEA;color: #003300;padding: 0 2px 5px 30px;">. . . .</div>
            </div>
        </div>
    </form>
</body>
</html>


how can i make it a user control without any problem?

解决方案

(document).ready(function () { var h = (


("#AbstractText").innerHeight() + 50) + "px"; var p =


("#AbstractText").innerHeight(); p > 400 ? p = p + 600 : p = p + 400;


这篇关于用户控件无法在我的js文件中执行js方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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