呵呵,那你要在刚才的那个JS函数基础上加一个一些事件啊
比如img.onclick=function(){alert(1)}
这样你就有一个点击的事件了

解决方案 »

  1.   

    你要拖动?
     我这里有一个拖动类

    /*
    Auth: jingliangliang
    Date: 2008-5-5
    Email: [email protected]
    */
    (function(){
    if(typeof Drag != "undefined")
    {
    var _Drag = Drag;
    }
    //此处声明Drag类
    //--elementid:要移动元素的ID
    var Drag = window.Drag = function(elementid){
    var thisDrag = this;
    this.DifWidth = 0;
    this.DifHeight = 0;
    this.thisDivDrag = document.getElementById(elementid);
    this.thisDivDrag.onmousedown = function(event){
    var theevent;
    var theSrcevent;
    if(window.event)
    {
    theevent = window.event;
    theSrcevent = window.event.srcElement;
    }
    else
    {
    theevent =event;
    theSrcevent =event.target;
    }
    thisDrag.DifWidth= theevent.clientX - theSrcevent.offsetLeft;
    thisDrag.DifHeight = theevent.clientY - theSrcevent.offsetTop;
    document.body.onmousemove =function(event){
    var theevent;
    if(window.event)
    {
    theevent = window.event;
    }
    else
    {
    theevent =event;
    }
    thisDrag.thisDivDrag.style.left = theevent.clientX -thisDrag.DifWidth ;
    thisDrag.thisDivDrag.style.top = theevent.clientY -thisDrag.DifHeight ;
    };
    document.body.onmouseup =function(event)
    {
    document.body.onmousemove = "";
    };
    };
    };
    })();
    ====实现方法:
    放一个js然后引用,window.onload=function(){
    __Drag = new Drag("div1");
    };
      

  2.   

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
    <title>无标题文档</title>
    <script>
    function showifra()
    {
    var img =window.frames["ifra"].document.createElement('img');  
    img.src="loading.gif";
    img.id="img1";
    img.style.position="absolute";
    img.onmousemove=moveImage; 
    window.frames["ifra"].document.getElementById("img").appendChild(img)
    }
    function moveImage(){
           window.frames["ifra"].document.getElementById("img1").style.left=200+"px";
           window.frames["ifra"].document.getElementById("img1").style.top=100+"px";
         }
    </script>
    </head><body>
    <iframe id="ifra" name="ifra" src="13.asp" width="600" height="500"></iframe>
    <input type="image" onclick="showifra()" src="loading.gif"/>
    </body>
    </html>我只给你一个简单的例子
    你自己再扩展 moveImage这个函数即可