42 users online (1 members and 41 guests)  


  Results 1 to 2 of 2

Related

  1. Replies: 1
  2. Replies: 0
  3. IE/Firefox discrepencies!!    Forum: Myspace Forum
    Replies: 2
  4. Replies: 5
  5. Firefox newbie!    Forum: General Discussion
    Replies: 2
  1. #1
    kamii47's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    3

    Question Equivalent JavaScript for FireFox

    I have to do drag and drop.Following one is runing well in IE But not in FireFox.Can please any body help me in finding a one for fireFox



    Code:
    <html>
    <head>
          <title>Test Page</title>
    
          <script language="JavaScript" type="text/javascript">
          
          function processDrop()
          {
                var link = document.getElementById("link1");
    
                if(window.event)
                {
    
                      var abc = window.event.dataTransfer.getData('Text');		alert("Text is " + abc);
                      link.href = window.event.dataTransfer.getData('Text');
    
                      link.style.display = "inline";
                }
    
                return false;
          }
          
          </script>
    </head>
    
    <body>
          <div id="layer1" style="height:200px; width:200px; border:1px black solid;" ondragover="javascript:return false;" ondragenter="javascript:return false;" ondrop="javascript:processDrop();"></div>
    
          <br><br>
    
          <a id="link1" style="display:none;"><img id="image1" src="http://www.experts-exchange.com/images/certification.gif" style="border:none;" /></a>
    
    </body>
    </html>
    Last edited by vinyl-junkie; 07-31-2007 at 08:26 PM. Reason: Added code tags

  2. #2
    kamii47's Avatar
    New User

    Status
    Offline
    Join Date
    Jul 2007
    Posts
    3

    Re: Equivalent JavaScript for FireFox

    The thing I want's to achieve is draging some sort of Address from a Text File
    Then By the help of a javascript function parse that data and extract my needed info.

    IN IE Following Works But How Can I achieve it in FireFox

    Code:
      function processDrop()
      {           
    
                if(window.event)
                {
                   var ClipBoardText = window.event.dataTransfer.getData('Text');
                    var broken_up_string = ClipBoardText.split(",");                
                    var firstPart = broken_up_string[0];
                    firstPart = firstPart.split("\r\n");
                    var Address = "";
                    var City = "";
                    State = "";
                    for(var i = 0; i < firstPart.length -1; i++) 
                    {
                        Address = Address + firstPart[i] + "\r\n";
                        if(i == firstPart.length - 2)
                        {
                            City = firstPart[i+1];
                        }
                    }
                            
                    var secondPart = broken_up_string[1];              
                    alert("Address is " + Address); 
                    alert("City is " + City);        
                    alert("Rest is " + secondPart); 
                }
                return false;
          }
    
    
     <div id="layer1" style="height: 200px; width: 200px; border: 1px black solid;" ondragover="javascript:return false;"
                        ondragenter="javascript:return false;" ondrop="javascript:processDrop();">
                    </div>
    Last edited by vinyl-junkie; 08-01-2007 at 08:37 PM. Reason: Added code tags



Tags for this Thread