<A id = "downloadFileLink" href = "1.html"> </a>
Var downloadLink = document. getElementById ('downloadfilelink ');
DownloadLink. onclick (); // this sentence can't run in firefox
Solution:
Add an onclick event to the tag <a id = "downloadFileLink" href = "1.html" onclick = "alert ('A');"> </a>
Var downloadLink = document. getElementById ('downloadfilelink ');
DownloadLink. onclick = Function ("location. href = 'downloadhandler. ashx? FileName = "+ fileName +" & filePath = "+ filePath + "'");
DownloadLink. style. display = 'block ';
DownloadLink. style. display. visibility = 'den den ';
// DownloadLink. onclick (); // this sentence can't run in firefox
If (document. all & typeof (document. all) = "object") // IE
{
DownloadLink. fireEvent ("onclick ");
}
Else {
Var e = document. createEvent ('mouseevent ');
E. initEvent ('click', false, false );
DownloadLink. dispatchEvent (e );
}
Return false;