Forum Moderators: open
<script language="javascript">
function trackit()
{
window.open("download/download.htm", "windowname", "settings");
return false;
}
</script>
This code is working fine in IE and Opera i.e. a new window opens (download/download.htm) by clicking on the image link but in Firefox the onclick event does not get triggered and the normal href get executed.
Any workarounds?
Milan
onclick="trackit(); return false;"
Did not worked. It still triggeres the href link and onclick gets bypassed. Moreover i have already added "return false;" in the function itself so it should be sufficient for it (my guess).
As i have already posted the actual code, the only thing trackit() function does is opening a new page of "download/download.htm" with window.open.
Milan
You can also try:
<a href="#" onclick="trackit('download/download.htm')"><img src="download/filename.jpg"></a>
<script language="javascript">
function trackit(url)
{
var url;
window.open(url, "windowname", "settings");
return false;
}
</script>
dc
Finally i merged your code with mine as i had to put that onclick event on 50+ link tags and all is working fine in IE, FF and OP.
<a href="download/filename.exe" onclick="trackit(this)"><img src="download/filename.jpg"></a>
<script language="javascript">
function trackit(filename)
{
window.open(filename, "windowname", "settings");
}
</script>
Thanks again.
Milan