Event undefined
Hej Eksperter,Jeg har en funktion, som opretter et div-element og sætter nogle properties:
function newDiv() {
var dialog = document.createElement('div');
dialog.id = dialogId;
document.body.appendChild(dialog);
dialogHeader.onmousedown = function() {
DragLayer(dialogId, event);
dragLayerIsMoving = true;
}
}
function DragLayer(dragLayerId) {
if (!e) var e = window.event;
if (dragLayerId != '') {
dragLayerOffsetX = document.getElementById(dragLayerId).offsetLeft;
dragLayerOffsetY = document.getElementById(dragLayerId).offsetTop;
dragLayerMouseX = e.clientX;
dragLayerMouseY = e.clientY;
document.onmousemove = function() {
document.getElementById(dragLayerId).style.left = (dragLayerOffsetX + e.clientX - dragLayerMouseX) + 'px';
document.getElementById(dragLayerId).style.top = (dragLayerOffsetY + e.clientY - dragLayerMouseY) + 'px';
}
}
}
Mit problem er, at i alle andre browsere end IE er "e" undefined.
Hvad gør jeg galt?