why this code doesn't work in firefox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wgale025
    New Member
    • Feb 2007
    • 23

    #1

    why this code doesn't work in firefox?

    [HTML]

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head><title>dr ag</title>
    <style>
    <!--.drag{position: relative;}
    -->
    </style>
    <script language="JavaS cript">
    String.prototyp e.inc=function( s){return this.indexOf(s) >-1?true:false}
    var agent=navigator .userAgent
    window.isOpr=ag ent.inc("Opera" )
    window.isIE=age nt.inc("IE")&&! isOpr
    window.isMoz=ag ent.inc("Mozill a")&&!isOpr&&!i sIE

    var dragapproved=fa lse
    var z,x,y,t1,t2
    function move(){
    var oEvent=null,oEl ement=null;
    if(isMoz){
    oEvent=argument s[0];
    oElement=oEvent .target;
    }else{
    oEvent=window.e vent;
    oElement=oEvent .srcElement;
    }
    if (oEvent.button= =1&&dragapprove d){
    //z.style.pixelLe ft=temp1+oEvent .clientX-x
    //z.style.pixelTo p=temp2+oEvent. clientY-y
    z.style.pixelLe ft=t1+oEvent.cl ientX-x
    z.style.pixelTo p=t2+oEvent.cli entY-y
    return false
    }}
    function drags(){
    var oEvent=null,oEl ement=null;
    if(isMoz){
    oEvent=argument s[0];
    oElement=oEvent .target;
    }else{
    oEvent=window.e vent;
    oElement=oEvent .srcElement;
    }
    if (oElement.class Name=="drag"){
    dragapproved=tr ue
    z=oElement;
    t1=z.style.pixe lLeft
    t2=z.style.pixe lTop
    x=oEvent.client X
    y=oEvent.client Y
    document.onmous emove=move
    }}
    document.onmous edown=drags
    document.onmous eup=new Function("draga pproved=false")
    </script>
    </head><body>
    <img src="http://www.hongen.com/pc/homepage/javascript/sample/img/draw.jpg" class="drag"></body>
    </html>

    [/HTML]

    it works in IE very well.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Originally posted by wgale025
    it works in IE very well.
    Fantastic. What does it do? And what doesn't it do in Firefox? Are you getting an error?

    Comment

    Working...