错误:'null'为null或不是JQuery RSS中的对象 [英] Error: 'null' is null or not an object in JQuery RSS

查看:74
本文介绍了错误:'null'为null或不是JQuery RSS中的对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Jquery中收到错误为null或不是对象。 

我在jquery中声明了div标签值。但是,它仍然是获得null对象。

请参阅下面的代码。

母版页
-----------
< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = server >
< title > < / title >

< link < span class =code-attribut e> type = text / css rel = 样式表 href = 样式/ Home.css / >

< asp:ContentPlaceHolder ID = paneContentPlace runat = server >


< / asp:ContentPlaceHolder >

< / head >


ASPX Page
-------------

< asp:Content ID = < span class =code-keyword> Content3 ContentPlaceHolderID = paneContentPlace runat = 服务器 > < /跨度>

< script language = javascript type = text / javascript >
$(document).ready(function(){
$( div.ContainerPanel)。toggle(/ ***********错误放置('null'或非null对象)****** /
function(){
$(this).parent()。next(div.Content)。show(slow);
$(this).attr(class,ArrowClose);
});
alert(Hello Word);

});
< / script >

< style type = text / css >
.ContainerPanel
{
width:400px;
border:1px;
border-color:#1052a0;
border-style:双倍双倍双倍;
}
.collapsePanelHeader
{
宽度:400px;
身高:30px;
background-image:url('../ images / bg-menu-main.png');
background-repeat:repeat-x;
颜色:#FFF;
font-weight:bold;
}
.HeaderContent
{
float:left;
padding-left:5px;
}
。内容
{

}
.ArrowExpand
{
background-image:url('../图像/ expand_blue.jpg');
宽度:13px;
身高:13px;
float:right;
margin-top:7px;
margin-right:5px;
}
.ArrowExpand:悬停
{
cursor:hand;
}
.ArrowClose
{
background-image:url('../ images / collapse_blue.jpg');
宽度:13px;
身高:13px;
float:right;
margin-top:7px;
margin-right:5px;
}
.ArrowClose:悬停
{
cursor:hand;
}

< / style >

< / asp:Content >
< asp :UpdatePanel ID = upnl1 runat = 服务器 >
< ContentTemplate >
< span class =code-keyword><
div >
< div id = ContainerPanel class = ContainerPanel >
< div id = header class = collapsePanelHeader >
< <跨度class =code-leadattribute> div id = dvHeaderText class = HeaderContent >
jQuery可折叠Panel1 < / div >
< div id = dvArrow class = ArrowExpand >
< / div >
< / div >
< div id = < span class =code-keyword> dvContent class = 内容 样式 = display:none > ;
在相册列表页面中,我们将以Tiled格式连续显示3张专辑,即重复
在我们的例子中,它是LastItem。
< / div >
< / div >
< br / >
< div id = Div1 class = ContainerPanel >
< div id = Div2 < span class =code-attribute> class = collapsePanelHeader >
< div id = Div11 class = HeaderContent >
jQuery可折叠Panel2 < / div >
< div id = Div3 class = ArrowExpand >
< / div >
< / div >
< div class = 内容 style = display:none >
测试
< / div >
< / div >
< / div >
< / ContentTemplate >
< / asp:UpdatePanel > ;

解决方案

(document).ready(function(){


(div.ContainerPanel)。toggle(/ ***********错误放置('null'或非null对象)****** /
function(){

(本).parent()下( div.Content)显示( 慢);

I am getting error in Jquery as 'null' or not an object.

I have declared the div tag values in jquery. but, still it is getting null object.

see my code below.

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

    <link type="text/css" rel="Stylesheet" href="Styles/Home.css" />

    <asp:ContentPlaceHolder ID="paneContentPlace" runat="server">


    </asp:ContentPlaceHolder>

</head>


ASPX Page
-------------

<asp:Content ID="Content3" ContentPlaceHolderID="paneContentPlace" runat="Server">

        <script language="javascript" type="text/javascript">
            $(document).ready(function () {
                $("div.ContainerPanel").toggle(   /*********** Error Place ('null' or not null object)******/
                function () {
                    $(this).parent().next("div.Content").show("slow");
                    $(this).attr("class", "ArrowClose");
                });
                alert("Hello Word");

            });
        </script>

        <style type="text/css">
        .ContainerPanel
{
 width:400px;
 border:1px;
 border-color:#1052a0;
 border-style:double double double double;
}
.collapsePanelHeader
{
    width: 400px;
    height: 30px;
    background-image: url('../images/bg-menu-main.png');
    background-repeat: repeat-x;
    color: #FFF;
    font-weight: bold;
}
.HeaderContent
{
 float:left;
 padding-left:5px;
}
.Content
{

}
.ArrowExpand
{
    background-image: url('../images/expand_blue.jpg');
    width: 13px;
    height: 13px;
    float: right;
    margin-top: 7px;
    margin-right: 5px;
}
.ArrowExpand:hover
{
 cursor:hand;
}
.ArrowClose
{
    background-image: url('../images/collapse_blue.jpg');
    width: 13px;
    height: 13px;
    float: right;
    margin-top: 7px;
    margin-right: 5px;
}
.ArrowClose:hover
{
 cursor:hand;
}

</style>

</asp:Content>
  <asp:UpdatePanel ID="upnl1" runat="server">
        <ContentTemplate>
  <div>
                <div id="ContainerPanel" class="ContainerPanel">
                    <div id="header" class="collapsePanelHeader">
                        <div id="dvHeaderText" class="HeaderContent">
                            jQuery Collapsible Panel1</div>
                        <div id="dvArrow" class="ArrowExpand">
                        </div>
                    </div>
                    <div id="dvContent" class="Content" style="display: none">
                        In Album List Page, we will display 3 albums in a row in Tiled format i.e. to repeat
                        In our case, it is LastItem.
                    </div>
                </div>
                <br />
                <div id="Div1" class="ContainerPanel">
                    <div id="Div2" class="collapsePanelHeader">
                        <div id="Div11" class="HeaderContent">
                            jQuery Collapsible Panel2</div>
                        <div id="Div3" class="ArrowExpand">
                        </div>
                    </div>
                    <div class="Content" style="display: none">
                        Test
                    </div>
                </div>
</div>
     </ContentTemplate>
    </asp:UpdatePanel>

解决方案

(document).ready(function () {


("div.ContainerPanel").toggle( /*********** Error Place ('null' or not null object)******/ function () {


(this).parent().next("div.Content").show("slow");


这篇关于错误:'null'为null或不是JQuery RSS中的对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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