Ext.onReady(function(){
<%
for(int k = 0; k<items.size();k++){
%>
var menu<%=k%> = new Ext.menu.Menu({
id: 'mainMenu<%=k%>',
style: {
overflow: 'visible' // For the Combo popup
},
items: <%=items.get(k)%>
});
var td<%=k%> = Ext.get("menu_td<%=k%>");
td<%=k%>.on("mouseover",function(e){
menu<%=k%>.show(this);
var ell<%=k%> = menu<%=k%>.getEl(); ell<%=k%>.on("mouseout",function(e){
menuBehavior(menu<%=k%>);
});
});
td<%=k%>.on("mouseout",function(e){
if(menu<%=k%>.isVisible()){
menuBehavior(menu<%=k%>);
}
});
<%
}
%>
function menuBehavior(submenus){ alert(getEvent.clientX);//这里弹出undefined };
});
function getEvent()
{
if(document.all)
return window.event;
func=getEvent.caller;
while(func!=null){
var arg0=func.arguments[0];
if(arg0)
{
if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
{
return arg0;
}
}
func=func.caller;
}
return null;
}
<%
for(int k = 0; k<items.size();k++){
%>
var menu<%=k%> = new Ext.menu.Menu({
id: 'mainMenu<%=k%>',
style: {
overflow: 'visible' // For the Combo popup
},
items: <%=items.get(k)%>
});
var td<%=k%> = Ext.get("menu_td<%=k%>");
td<%=k%>.on("mouseover",function(e){
menu<%=k%>.show(this);
var ell<%=k%> = menu<%=k%>.getEl(); ell<%=k%>.on("mouseout",function(e){
menuBehavior(menu<%=k%>);
});
});
td<%=k%>.on("mouseout",function(e){
if(menu<%=k%>.isVisible()){
menuBehavior(menu<%=k%>);
}
});
<%
}
%>
function menuBehavior(submenus){ alert(getEvent.clientX);//这里弹出undefined };
});
function getEvent()
{
if(document.all)
return window.event;
func=getEvent.caller;
while(func!=null){
var arg0=func.arguments[0];
if(arg0)
{
if((arg0.constructor==Event || arg0.constructor ==MouseEvent) || (typeof(arg0)=="object" && arg0.preventDefault && arg0.stopPropagation))
{
return arg0;
}
}
func=func.caller;
}
return null;
}
alert(getEvent().clientX);
IE里能获取到坐标,但是在火狐狸获取不到,是不是onready的问题? 在本个页面的其他js里可以获取到,在这个onready里就获取不到~
在页面重新写个js方法就可以获取到,
唯独在这个js方法里获取不到...
return event?event:window.event;
}
在IE里好使,在firefox里不好使