QUERY: IE vs Firefox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

QUERY: IE vs Firefox

dhruba.bandopadhruba.bandopa Posts: 28Member
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?

Comments

  • zibadianzibadian Posts: 6,349Member
    : 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?
    :
    The window.event object doesn't exist in FF. source: http://www.w3schools.com/htmldom/dom_obj_window.asp
    But drag-drop isn't a W3C standard, so it might only stay implemented in IE.
    You should check the w3schools more often for these kinds of questions. There you can quickly see which functions/objects are supported by which browser, and also if it is a W3C standard.
  • dhruba.bandopadhruba.bandopa Posts: 28Member
    I have read that there's a onDragDrop event in the standards W3C. However it only gives as much information as who the sender was. What I would like is to set up some data hence the usefulness of IE's dataTransfer object.

    Am not sure whether it's possible to set up a 'text' type data (eg. "1234|Some code|Some type") during the drag, and then drop it onto a table row... in Firefox. I've googled and still no luck finding an alternative to IE's dataTransfer object. :(
  • dhruba.bandopadhruba.bandopa Posts: 28Member
    [b][red]This message was edited by dhruba.bandopa at 2006-6-26 9:59:16[/red][/b][hr]
    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?
  • zibadianzibadian Posts: 6,349Member
    : [b][red]This message was edited by dhruba.bandopa at 2006-6-26 9:59:16[/red][/b][hr]
    : 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?
    :
    Look through the lists on www.w3schools.com. It lists all the supported functions for the various browsers. I never implement drag-drop, because I only use the mouse when absolutely necessary, and nearly all drag-drop operations can also be done using the keyboard.
Sign In or Register to comment.