下面的代码是关于单击鼠标右键,弹出的菜单会被覆盖
请问这其中的几句话应该怎么理解(1)<body onmousemove="MoveObj()" onmousedown="MoveObj()" onmouseup="MoveObj()" >
答:是否是当鼠标移动,按下,谈出都会调用script的MoveObj()方法,(2)<object id="objContent" classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" style="position: absolute; top: 0; left: 0;width:1;height:1;"></object>
问:这句话代表什么意思,希望具体些,谢谢(3)objContent.SetContextMenu(menuStrings, menuStates);
问:这句话代表什么意思,是设置鼠标吧(4)当运行下面的代码后,可以谈出自己定义的菜单,但是,不知道为什么左键不能选定其他对象,这是个很严重的问题,希望帮助解决!谢谢!<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>系统菜单-51windows.Net</title>
<head>
<meta name="keywords" content="51windows.Net">
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
</head>
<body onmousemove="MoveObj()" onmousedown="MoveObj()" onmouseup="MoveObj()" >
<p>请点右键</p><object id="objContent" classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" style="position: absolute; top: 0; left: 0;width:1;height:1;"></object><SCRIPT LANGUAGE="JavaScript">function fu(id){
document.write("123");
}var ContextMenu = new Array() ;
function ContextMenuItem(text, command, state){
this.Text = text ;
this.Command = command || "void(0)" ;
this.state = state;
}ContextMenu[0] = new ContextMenuItem("前进(&B)","go(1)",0);
ContextMenu[1] = new ContextMenuItem("后退(&O)","abc()",0);
ContextMenu[2] = new ContextMenuItem("未选中(&S)","s()",0);
ContextMenu[3] = new ContextMenuItem("","",0);
ContextMenu[4] = new ContextMenuItem("新窗口(&W)","window.open('http://www.baidu.com')",0);for (i = 5 ; i < 10; i++ ){
ContextMenu[i] = new ContextMenuItem("菜单 (&"+i+")","ContextMenu["+i+"].state=(ContextMenu["+i+"].state==0)?1:0",0);
}function s(){
if (ContextMenu[2].Text == "选中(&S)"){
ContextMenu[2].Text = "未选中(&S)";
ContextMenu[2].state = 0;
}
else{
ContextMenu[2].Text = "选中(&S)";
ContextMenu[2].state = 1;
}
}function go(n){
ContextMenu[0].state = (n==1)?2:0;
ContextMenu[1].state = (n==1)?0:2;
}function abc(){
for(i = 1;i < 100 ; i++ ){
document.write(i);
}
}function showContextMenu(iMenu){
var i ;
var menuStrings = new Array();
var menuStates = new Array();
for ( i = 0 ; i < ContextMenu.length ; i++ ){
menuStrings[i] = ContextMenu[i].Text ;
menuStates[i] = ContextMenu[i].state ;
}
objContent.SetContextMenu(menuStrings, menuStates);
}
function MoveObj(){
objContent.style.top = window.event.y-2
objContent.style.left = window.event.x-2
}</SCRIPT><script language="javascript" event="ShowContextMenu" for="objContent">showContextMenu(ContextMenu) ;</script><script language="javascript" event="ContextMenuAction(itemIndex)" for="objContent">eval(ContextMenu[itemIndex].Command);</script></html>
请问这其中的几句话应该怎么理解(1)<body onmousemove="MoveObj()" onmousedown="MoveObj()" onmouseup="MoveObj()" >
答:是否是当鼠标移动,按下,谈出都会调用script的MoveObj()方法,(2)<object id="objContent" classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" style="position: absolute; top: 0; left: 0;width:1;height:1;"></object>
问:这句话代表什么意思,希望具体些,谢谢(3)objContent.SetContextMenu(menuStrings, menuStates);
问:这句话代表什么意思,是设置鼠标吧(4)当运行下面的代码后,可以谈出自己定义的菜单,但是,不知道为什么左键不能选定其他对象,这是个很严重的问题,希望帮助解决!谢谢!<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<title>系统菜单-51windows.Net</title>
<head>
<meta name="keywords" content="51windows.Net">
<meta http-equiv=Content-Type content="text/html; charset=gb2312">
</head>
<body onmousemove="MoveObj()" onmousedown="MoveObj()" onmouseup="MoveObj()" >
<p>请点右键</p><object id="objContent" classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" style="position: absolute; top: 0; left: 0;width:1;height:1;"></object><SCRIPT LANGUAGE="JavaScript">function fu(id){
document.write("123");
}var ContextMenu = new Array() ;
function ContextMenuItem(text, command, state){
this.Text = text ;
this.Command = command || "void(0)" ;
this.state = state;
}ContextMenu[0] = new ContextMenuItem("前进(&B)","go(1)",0);
ContextMenu[1] = new ContextMenuItem("后退(&O)","abc()",0);
ContextMenu[2] = new ContextMenuItem("未选中(&S)","s()",0);
ContextMenu[3] = new ContextMenuItem("","",0);
ContextMenu[4] = new ContextMenuItem("新窗口(&W)","window.open('http://www.baidu.com')",0);for (i = 5 ; i < 10; i++ ){
ContextMenu[i] = new ContextMenuItem("菜单 (&"+i+")","ContextMenu["+i+"].state=(ContextMenu["+i+"].state==0)?1:0",0);
}function s(){
if (ContextMenu[2].Text == "选中(&S)"){
ContextMenu[2].Text = "未选中(&S)";
ContextMenu[2].state = 0;
}
else{
ContextMenu[2].Text = "选中(&S)";
ContextMenu[2].state = 1;
}
}function go(n){
ContextMenu[0].state = (n==1)?2:0;
ContextMenu[1].state = (n==1)?0:2;
}function abc(){
for(i = 1;i < 100 ; i++ ){
document.write(i);
}
}function showContextMenu(iMenu){
var i ;
var menuStrings = new Array();
var menuStates = new Array();
for ( i = 0 ; i < ContextMenu.length ; i++ ){
menuStrings[i] = ContextMenu[i].Text ;
menuStates[i] = ContextMenu[i].state ;
}
objContent.SetContextMenu(menuStrings, menuStates);
}
function MoveObj(){
objContent.style.top = window.event.y-2
objContent.style.left = window.event.x-2
}</SCRIPT><script language="javascript" event="ShowContextMenu" for="objContent">showContextMenu(ContextMenu) ;</script><script language="javascript" event="ContextMenuAction(itemIndex)" for="objContent">eval(ContextMenu[itemIndex].Command);</script></html>
解决方案 »
- 谁可以让下面这代码可以在火狐上面运行出来啊?帮帮忙
- 用列表的形式展示树信息
- struts2控制转向后页面图标就显示不出来了
- help,ejb部署在weblogic失败~~~~~~~~
- 各位高手帮忙看一下了!!!!!
- 急得吃不下饭,快来帮我看一下吧!!
- 100分急求jsp自动发送邮件程序。
- 关于tomcat下面数据连接池的问题!请执教!~再线等待
- 急:jsp中如何连接数据库比如:orcale或sql server
- jsp与php之间的问题!请高手们帮忙!
- jdk1.4.2 + resin-3.0.8 + window 2000 server 重启resin或服务器后中文出现乱码的问题。
- 由asp.net转向jsp,初学 ,大家给点建议,(顶者有分)
写的没错,是都会触发MoveObj函数但是只有onmousemove事件起作用,因为当鼠标按下和弹起来时都会先触发onmousemove事件2)注册控件
)<object id="objContent" classid="clsid:2D360201-FFF5-11D1-8D03-00A0C959BC0A" style="position: absolute; top: 0; left: 0;width:1;height:1;"></object>
classid是注册表中的值,style后面的是样式:位置、高、左、长和宽
mail: [email protected]
谢谢各位的支持!
<body onmousemove="MoveObj()" onmousedown="MoveObj()" onmouseup="MoveObj()" >
这里.
如果去掉onmousemove="MoveObj()";使其不在调用MoveObj()方法,,就可以选择其他对象,
但是会出现一个新问题,就是说右键弹出菜单的时候就需要按两下鼠标才可以
这个问题如何解决,请教一下