attach handler to element in parent

I have two frames: One is the parent and another the child.

From the child page i want to attach a eventHandler. I am not able to get the code running. The code in the eventHandler is never called. If i refer to elements that are on the child page then the code works correctly.

To make sure that i am referring to the elements in the parent correctly i tested by changing the bg color to the desired elements in the code (this worked sussesfully.)(see code below)

var drop = $('#alignmentBox', window.parent.document);

I am not really seeing any errors in firebug but simply that the code inside the eventHandler is not being called.

This is the eventHandler

// Tells the browser that we *can* drop on this target
            addEventHandler(drop, 'dragover', function (e) {
                e = e || window.event; // get window.event if e argument missing (in IE) 
                if (e.preventDefault) {
                fileNumber = fileNumber + 1;
                //drop.innerHTML = fileNumber;
                $("#drop1").css('opacity', 0.5);
                var newFile =  $('#s-d12245cc-1680-458d-89dd-4f0d7fb22724', window.parent.document)[0];

                return false;

/seperate event
    function addEventHandler(obj, evt, handler) {
        if (obj.addEventListener) {
            // W3C method
            obj.addEventListener(evt, handler, false);
        } else if (obj.attachEvent) {
            // IE method.
            obj.attachEvent('on' + evt, handler);
        } else {
            // Old school method.
            obj['on' + evt] = handler;


You are trying to use native addEventListener on a jQUery object that you created drop. You can get the DOM element from the jQuery object by adding [0] to it


addEventHandler(drop[0], 'dragover', function (e) { 

Need Your Help

Data truncation: Incorrect datetime value: ''

java mysql jsp datetime jdbc

Can anyone help me with a sample JSP code to store date in a MySql database through JDBC?