Topic: Equivalent JavaScript for FireFox (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=29398" title="Pages that link to Topic: Equivalent JavaScript for FireFox (Page 1 of 1)" rel="nofollow" >Topic: Equivalent JavaScript for FireFox <span class="small">(Page 1 of 1)</span>\

 
kamii47
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jul 2007

posted posted 07-31-2007 21:21

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>

reisio
Paranoid (IV) Inmate

From: Florida
Insane since: Mar 2005

posted posted 08-01-2007 00:17

http://w3.org/TR/html401/index/attributes.html

kamii47
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jul 2007

posted posted 08-01-2007 07:21

I don't understand it.What i have to do is drag some text from a text file to a div section of my page.Here i will call a javascript function which will parse the text and put it in some text boxes.

WarMage
Maniac (V) Mad Scientist

From: Rochester, New York, USA
Insane since: May 2000

posted posted 08-01-2007 14:52

window.event is not a function in FireFox.

Drag and Drop is a pretty common function now. You can get it via the Scriptaculous library or the Dojo library (two I have used) I am sure there are many more cross browser libraries that you could explore for the same functionality.

As with most other things it is often easier to first develop for a Non-IE browser and then get it working in IE.

Dan
Code Town | Zombie Head | How Much TP?

kamii47
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jul 2007

posted posted 08-01-2007 17:32

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_stringnt;
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>



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu