Download link using Javascript issue in Opera 9 and Safari 4
Posted: Wed Mar 25, 2009 5:46 am
I had "inherited" a JS that displayed a popup div which contained a list of links with "operations" for the file that the user selected.
The original script worked with onmouseleave event and JS DOM script specific for IE. I made a new script to work with Firefox. The problem is that some operations with the new script don' t work in Opera 9.6 and Safari 4 beta.
The script:
The original script worked with onmouseleave event and JS DOM script specific for IE. I made a new script to work with Firefox. The problem is that some operations with the new script don' t work in Opera 9.6 and Safari 4 beta.
The script:
Code: Select all
//global variables
var dl_string;
var zoom_url;
//this function displays the popup div and initiliases the 'operations' functions with their parameters, which are global
function ShowDialog (e,param_1,param_2,param_3,param_4,param_5,param_6) {
zoom_url = param_1;
zoom_window_name = param_2;
zoom_window_params = param_3;
dl_string = param_4;
admin_permission = param_5;
file = param_6;
var color;
var x=0;
var y=0;
x = e.clientX;
y = e.clientY;
color = '#000000';
if (zoom_url == '') color='#ACA899';
var oDiv = document.getElementById('DialogZoom');
oDiv.style.color = color;
color = '#000000';
if (dl_string == '') color='#ACA899';
var oDiv = document.getElementById('DialogScarica');
oDiv.style.color = color;
var oDiv = document.getElementById('Mydialog');
oDiv.style.position='fixed';
oDiv.style.left = x +'px';
oDiv.style.top = y +'px';
oDiv.style.display = 'block';
}
//one of the non- working operation
function DialogDownload() {
if (dl_string != '') {
downloadFile(dl_string);
CloseDialog (e);
}
return false;
}
//closes the popup div when the mouse leaves it
function CloseDialog (e) {
//script by Peter-Paul Koch @ http://www.quirksmode.org
var tg = (window.event) ? e.srcElement : e.target;
if (tg.nodeName != 'DIV') return;
var reltg = (e.relatedTarget) ? e.relatedTarget : e.toElement;
while (reltg != tg && reltg.nodeName != 'BODY'){reltg= reltg.parentNode}
if (reltg== tg) {return;}
else{
var oDiv = document.getElementById('Mydialog');
oDiv.style.display = 'none';
}
}