QUERY: IE vs Firefox
Q(1)
I have created an array and store 3 functions in it. Eg.
this.validateCols = new Array();
this.validateCols[this.COST] = function(obj, index)
{
return 0;
};
this.validateCols[this.LOCKED] = function(obj, index)
{
return 0;
};
this.validateCols[this.COMPLETION] = function(obj, index)
{
return 0;
};
Calling validateCols[0](0, 0) works in IE, but in Firefox I get:
validateCols[0] is not a function
Is this the correct way to define functions in an array? Or is there a better way?
Or is this not supported at all in Firefox?
Q(2)
Also .swapNode() is not in Firefox? Any alternatives?
Q(3)
I implemented drag 'n' drop and it works in IE but not in Firefox.
Each droppable HTML TD element has:
ondragenter="this.parentNode.style.backgroundColor = 'gray'; window.event.returnValue = false;"
ondragover="window.event.returnValue = false;"
ondragleave="this.parentNode.style.backgroundColor = 'white'; window.event.returnValue = false;"
ondrop="OnDrop(this);"
Each draggable URL element has attributes:
id='draggable'
onmousemove='window.event.srcElement.dragDrop();'
ondragstart='window.event.dataTransfer.setData("text", "data");'
But this doesn't work in Firefox. Anyone got any ideas?
# 1 Re: QUERY: IE vs Firefox
hi,
well for issue 1, that has to be your fault, the following sample code works in FF:
<html>
<head>
<script type="text/javascript">
var aFuncs = new Array();
aFuncs[0] = function() {
alert('func 0');
};
aFuncs[1] = function() {
alert('func 1');
};
aFuncs[2] = function() {
alert('func 2');
};
function testit() {
for( var i in aFuncs ) {
aFuncs[i]();
}
}
</script>
</head>
<body>
<button onclick="testit()">test it!</button>
</body>
</html>
issue 2 and 3 are internet explorer proprietary stuff. maybe not even part of the w3c dom model.. well, i don't know at the moment.
but for issue 2 there is a simple workaround, just "prototype" the swapNode function for FF into the Node class.
here is an explanation how to do it (the first code snippet)
http://www.faqts.com/knowledge_base/view.phtml/aid/10808/fid/255
imho, with issue 3, unless there are no ondrag* events in FF you have to use the plain old onmouse* events
bigBA at 2007-11-8 0:40:22 >

# 3 Re: QUERY: IE vs Firefox
I am quite disappointed in the drag 'n' drop support in Mozilla Firefox. What am trying to achieve is dragging an element from one IFRAME/FRAME into another IFRAME/FRAME. But upon dropping the element, I do not want the target IFRAME/FRAME to open/load it. I want it simply to handle the event, such as parsing the element/data dropped. Such uses as dropping an element into a table inbetween rows 2 & 3.
I have studied Netscapes way of ondragdrop events. However this only handles dropping external files, into the browser window, and the browser window will open/load the file. This is not what I want.
The only closest IE/FF drag'n'drop thing I found was http://script.aculo.us/ however their dragging doesn't go across IFRAME/FRAMEs.
Is there any way Firefox will implement similar drag'n'drop events as IE's:
ondragenter, ondragleave, ondragover, ondrop? that works across IFRAME/FRAMEs?
# 4 Re: QUERY: IE vs Firefox
Okay, you are mixing up two things. Drag and drop functions in the OS vs. drap and drop functions with the browser.
Drag and drop does not work in IE/Firefox/Opera/Mozilla Suite...only scripting that acts like drag and drop. Now, since it is scripting, once you leave the frame, it is no longer recognized by the frame because its events will take place out of that frame.
You cannot "drag and drop" from frame to frame because scripting of that sort cannot be captured.
You might be able to try a cheap trick. I doubt that it will work though.
1. Use onmousedown to capture the elements ID to a hidden input's value.
2. Use onmouseup of the the frame you are dragging onto to get the value of the other frames hidden input. You will have to call parent.FRAMENAME.document.getElementById('HIDDENINPUTID').value.