SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Hybrid View

  1. #1
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Equivalent JavaScript to run in 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







    <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="javascriptrocessDrop();"></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>

  2. #2
    SitePoint Member
    Join Date
    Jul 2007
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

    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="javascriptrocessDrop();">
    </div>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •