去.NET 的论坛上面问问这个问题,包准有人回答

解决方案 »

  1.   

    1
    ----------<html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <style type=text/css>
    div{background-color: #D6D3CE; BORDER-TOP:thin outset; BORDER-RIGHT:thin outset; BORDER-BOTTOM:thin outset; BORDER-LEFT:thin outset;width:120;visibility:hidden; POSITION: absolute;font-size:9pt;line-height:150%}
    a:visited { color:#000000; text-decoration: none}
    a:link {  color: #000000; text-decoration: none}
    a:hover {  color:WHITE; text-decoration: none;background:#000000;width:120;height:18}
    </style>
    </head>
    <body oncontextmenu=self.event.returnValue=false>
    <script language=javascript src=title.js></script>
    <input type=hidden name=isout value=1>
    <div id=popupmenu calss=menu align=center onmouseout="document.all.isout.value=1;" onmouseover="document.all.isout.value=0;">
    <a href=# target=_blank>管理专区(<u>M</u>)</a><br>
    <a href=# target=_blank>网站服务(<u>S</u>)</a><br>
    <a href=# target=_blank>网站帮助(<u>H</u>)</a><br>
    <a href=# onclick="showModalDialog('about:blank','','dialogWidth:18;dialogHeight:2;dialogTop:50;dialogLeft:200;status:no;help:no;')">关于本站(<u>A</u>)</a><br>
    </div>
    <script language=javascript>
    function click()

    if (event.button==2)
    {
    popupmenu.style.visibility="inherit";
    popupmenu.style.left=event.x;
    popupmenu.style.top=event.y;
    }
    if (event.button==1 && document.all.isout.value==1)
    popupmenu.style.visibility="hidden";
    }
    document.onmousedown=click;
    </script>
    </body>
    </html>2
    --------
    <html>
    <head>
    </head>
    <script language=javascript>
    <!--
    function movestart(){
    ilastx=event.x;
    ilasty=event.y;
    }
    function moveme(){
    var newleft = movimg.offsetLeft + (event.x - ilastx);
    var newtop = movimg.offsetTop + (event.y - ilasty);
     if (newleft > 0 && newleft + movimg.offsetWidth < 800 && newtop>0 && newtop+movimg.offsetHeight<600)
     { 
       event.srcElement.style.cursor = "default";
       event.returnValue = false;
       movimg.style.left=newleft;
       movimg.style.top=newtop;
       ilastx=event.x;
       ilasty=event.y;
    }
    }
    //-->
    </script>
    <body>
       <img id=movimg SRC="http://www.csdn.net/images/ad/vsnet_120.gif" onmousedown="movestart();"  ondragstart="moveme();" style="LEFT: 75px; POSITION: absolute; TOP: 10px">
    </body>
    </html>
      

  2.   

    1.可以在oncontextmenu事件使用createPopup()创建的菜单。2.把图片放在一个div里面,然后定义div的绝对位置。
    <div id=div1 style="position:absolute" onmousedown="DragStart()" onmouseup="DragEnd()"><img src="xxxx.jpg"></div>
    <script>
    var layerx,layery;
    var bDrag; //标记是否开始拖动
    function DragStart() //开始拖动
    {
    layerx=window.event.clientX;
    layery=window.event.clientY;
    bDrag=true;
    }function document.onmousemove() //在鼠标移动事件中,如果开始拖动,则移动层
    {
    if(bDrag && window.event.button==1)
    {
    var Layer=document.all.div1.style;
    Layer.posLeft += window.event.clientX-layerx;
    Layer.posTop += window.event.clientY-layery;
    layerx=window.event.clientX;
    layery=window.event.clientY;
    }
    }function DragEnd(){ //结束拖动
    bDrag=false;
    }
    </script>