问题描述
我正在使用带有一点动画的菜单控件.
我正在使用另外两个munu's.我不想使用所有菜单.
我只想根据自己的情况一次只显示一个菜单控件.
我收到错误消息所需对象:在"DIV"中标识为空
我没有在代码中使用任何"DIV".为什么在"DIV"中显示为空
为什么会出现错误...?
请参阅下面的完整代码...
jQuery
-------
Hi,
I am using menu control with little bit animation.
I am using two more munu''s. I don''t want to use all the menu''s.
I want to display only one menu control at a time based on my condition.
I am getting error "object required:null identified in the "DIV"
I did''t use any "DIV" in my code. why it shows null identied in the "DIV"
why the error will come...?
see my complete code as below...
JQuery
-------
<script type="text/javascript">
$(function () {
$("ul.level1 li").hover(function () {
$(this).stop().animate({ opacity: 0.7, width: "210px" }, "slow");
}, function () {
$(this).stop().animate({ opacity: 1, width: "170px" }, "slow");
});
});
</script>
CSS代码
--------
CSS Code
--------
li
{
border:1px solid black;
padding:2px 2px 2px 2px;
width:210px;
background-color:#82C0FF;
color:black;
cursor:pointer;
}
a { color:black; font: bold 11px Verdana; }
ASPX页面
---------
ASPX Page
---------
<tr>
<td width="100%">
<%If Session("Admin") = "1" Then%>
<ul>
<asp:Menu ID="AdminMenu" runat="server" Orientation="Horizontal" RenderingMode="List">
<Items>
<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home" />
<asp:MenuItem Text="Master" Value="first">
<asp:MenuItem Text="A" Value="A"></asp:MenuItem>
<asp:MenuItem Text="B" Value="B"></asp:MenuItem>
<asp:MenuItem Text="C" Value="C"></asp:MenuItem>
<asp:MenuItem Text="D" Value="D"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Transaction" Value="Second">
<asp:MenuItem Text="A" Value="A"></asp:MenuItem>
<asp:MenuItem Text="B" Value="B"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Reports" Value="Third">
<asp:MenuItem Text="A" Value="A"></asp:MenuItem>
<asp:MenuItem Text="B" Value="B"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Others.aspx" Text="Others" Value="Others" />
</Items>
</asp:Menu>
</ul>
<%End If%>
</td>
<td style="width:400px; vertical-align:top">
<asp:ContentPlaceHolder id="CONTENT" Runat="Server"/>
</td>
</tr>
<tr>
<td width="100%">
<%If Session("Emp") = "2" Then%>
<ul>
<asp:Menu ID="AdminMenu" runat="server" Orientation="Horizontal" RenderingMode="List">
<Items>
<asp:MenuItem NavigateUrl="~/Home.aspx" Text="Home" Value="Home" />
<asp:MenuItem Text="Transaction" Value="Second">
<asp:MenuItem Text="A" Value="A"></asp:MenuItem>
<asp:MenuItem Text="B" Value="B"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem Text="Reports" Value="Third">
<asp:MenuItem Text="A" Value="A"></asp:MenuItem>
<asp:MenuItem Text="B" Value="B"></asp:MenuItem>
</asp:MenuItem>
<asp:MenuItem NavigateUrl="~/Others.aspx" Text="Others" Value="Others" />
</Items>
</asp:Menu>
</ul>
<%End If%>
</td>
<td style="width:400px; vertical-align:top">
<asp:ContentPlaceHolder id="ContentPlaceHolder1" Runat="Server"/>
</td>
</tr>
我得到的错误对我没有意义?
必需的对象
如果(this.element.tagName ===``DIV''){
在下面的系统生成的JavaScript摘录中突出显示了.
(但是我正在使用VB.Net-Framework 4.0-因此,DIV应该是div-但我没有div,所以看不到在哪里引入一个?)
if(!window.Sys){window.Sys = {}; }
如果(!Sys.WebForms){Sys.WebForms = {}; }
Sys.WebForms.Menu = function(options){
this.items = [];
this.depth = options.depth || 1;
this.parentMenuItem = options.parentMenuItem;
this.element = Sys.WebForms.Menu._domHelper.getElement(options.element);
如果(this.element.tagName ===``DIV''){
var containerElement = this.element;
this.element = Sys.WebForms.Menu._domHelper.firstChild(containerElement);
this.element.tabIndex = options.tabIndex || 0;
options.element = containerElement;
options.menu = this;
this.container = new Sys.WebForms._MenuContainer(options);
Sys.WebForms.Menu._domHelper.setFloat(this.element,this.container.rightToLeft?"right":"left");
}
其他{
this.container = options.container;
this.keyMap = options.keyMap;
}
The error I get makes NO sense to me?
Object required
if (this.element.tagName === ''DIV'') {
is highlighted in the extract from the system generated JavaScript below.
(But I''m using VB.Net - Framework 4.0 - so, DIV should be div - but I have no div and can''t see where to introduce one?)
if (!window.Sys) { window.Sys = {}; }
if (!Sys.WebForms) { Sys.WebForms = {}; }
Sys.WebForms.Menu = function(options) {
this.items = [];
this.depth = options.depth || 1;
this.parentMenuItem = options.parentMenuItem;
this.element = Sys.WebForms.Menu._domHelper.getElement(options.element);
if (this.element.tagName === ''DIV'') {
var containerElement = this.element;
this.element = Sys.WebForms.Menu._domHelper.firstChild(containerElement);
this.element.tabIndex = options.tabIndex || 0;
options.element = containerElement;
options.menu = this;
this.container = new Sys.WebForms._MenuContainer(options);
Sys.WebForms.Menu._domHelper.setFloat(this.element, this.container.rightToLeft ? "right" : "left");
}
else {
this.container = options.container;
this.keyMap = options.keyMap;
}
推荐答案
这篇关于菜单设计控件中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!