在网页里做类似window右键的弹出式菜单

做一个类似于window右键的弹出式菜单。 
代码如下:   
var obj; 
function loadobj(o)
{
  obj=o;

function expand()
{
  var h=parseInt(obj.height);
  var w=parseInt(obj.width);
  var op=10; 
  if( h<=170 )
  {
    if( w<60 )
      obj.style.width=w 6; 
    obj.style.height=h 17; 
    x=setTimeout('expand()', 25);
  }
  else
  {
    obj.style.width=60;
    obj.style.height=174;
    clearTimeout(x);
  }

var drag=0;
var move=0;
function Dblclick()
{
  if (event.button==0)
    {
      obj.style.visibility="visible";
      obj.style.left=window.event.x;
      obj.style.top =window.event.y;
      obj.style.width=0;
      obj.style.height=0; 
      obj.filters.item(0).apply();
      obj.filters.item(0).transition = 25;
      obj.filters(0).play(0.5); 
      expand();
    }

function MouseMove()
{
  if(move==1)
    {
      obj.style.cursor="move";
      obj.style.left=window.event.x-l;
      obj.style.top=window.event.y-t;
    }

function MouseDown()
{
  if(drag) 
    {
      l = window.event.x - parseInt(obj.style.left);
      t = window.event.y - parseInt(obj.style.top);
      obj.style.zIndex =1;
      move=1;
    }
  else
    {
      document.body.style.cursor='default';
      obj.style.visibility='hidden';
    }

function MouseStop()
{
  window.event.returnValue=false;

function MouseUp()
{
  move=0;
  obj.style.cursor="hand";

document.ondblclick=Dblclick;
document.onmousedown=MouseDown;
document.onmousemove=MouseMove;
document.ondragstart=MouseStop;
document.onmouseup=MouseUp;

 感谢原创者的辛勤劳动,希望对您有所帮助,转载请注明原出处。
 您可能对 [javascript] 的这些文章也感兴趣:

基础知识:JavaScript、Jscript、VBScript、ASP的区别
关于ie的内存泄漏与javascript内存释放
归纳:编写Java程序最容易犯的21种错误
Javascript实例教程(19) 使用HoTMetal(3)
javascript获得Request变量值
JavaScript学习笔记(7) IE环境下cloneNode的一个bug
一行代码生成Google SiteMap
改变样式表的js语句
用javascript 转换网站外部链接样式
JavaScript面向对象------继承