?
Solved

onclick="func();return false;" doesn't work

Posted on 2001-07-18
4
Medium Priority
?
1,587 Views
Last Modified: 2012-08-13
I used function as below, after I cacel or ok in download dialog box, the animation GIF stoped, return false dooesn't work, does anyone help me?

<script language="javascript">
  function goDownload()
  {
  window.location.href="your_file.zip";
  }
  </script>
   
  <a href=javascrip:void" onClick="goDownload();return false;">Download</a>
0
Comment
Question by:mikezang
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 200 total points
ID: 6294805
<script language="javascript">
function goDownload(filename) {
   window.open(filename,'_blank');
}
</script>
<a href="your_file.zip" onClick="goDownload(this.href);return false;">Download</a>

Michel
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6294818
Or like this:

<script language="javascript">
   function goDownload(filename) {
      window.open('dl.html?'+filename,'_blank');
}
</script>
<a href="your_file.zip" onClick="goDownload(this.href);return false;">Download</a>

where dl.html has

<body onLoad="window.location=window.location.search.substring(1); setTimeout('window.close()',2000)">
0
 
LVL 15

Expert Comment

by:a.marsh
ID: 6295501
You can use the methods as mentioned by Michel, or you can do this (which is what I think you were trying to do in the first place):

<a href=javascrip:void(0);" onClick="goDownload();">Download</a>


:o)

Ant
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 6295934
1. it is javascript:void(0) and that is JS1.1 only
2. The reason the gif died was the window.location changes

Michel
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question