473,406 Members | 2,371 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with window popup: open before file download

263 100+
Hi all.

I have this form:

Expand|Select|Wrap|Line Numbers
  1. <form method="POST" action="default.asp?ID=<%=strID%>">    
  2.      <input type="image" src="download.gif">
  3. </form>
I need before the download file open window popup with advice not to change the file name... can you help me?

Kind regards
viki
May 21 '09 #1
11 5415
acoder
16,027 Expert Mod 8TB
You could add it onclick (of the image button) or onsubmit (form). You may want to use DHTML instead of a popup window, but if you want a window, use window.open().
May 21 '09 #2
viki1967
263 100+
thanks acoder.... one example please ?
May 21 '09 #3
acoder
16,027 Expert Mod 8TB
It's as simple as adding an onclick to the input image:
Expand|Select|Wrap|Line Numbers
  1. <input type="image" src="download.gif" onclick="window.open(...)">
For more details on window.open(), see window.open() - MDC
May 21 '09 #4
viki1967
263 100+
thanks... I modify and working... it's correct?

Expand|Select|Wrap|Line Numbers
  1. <form method="POST" action="default.asp?ID=<%=strID%>" onsubmit="return(richiama(this));">     
  2.      <input type="image" src="download.gif"> 
  3. </form>
  4.  
  5. <script language="javascript" type="text/javascript">
  6. <!--
  7.  
  8. function richiama(parametro)
  9. {
  10. window.open('popup.asp?ID=<%=strID%>','', 'scrollbars=yes,width=550,height=350');
  11. }
  12.  
  13. //-->
  14. </script>
  15.  
May 21 '09 #5
acoder
16,027 Expert Mod 8TB
Should be. You don't need to pass 'this' to the function. If you want to keep a reference to the opened window to close it later, set it to a variable.
May 21 '09 #6
viki1967
263 100+
OK... I modify:

Expand|Select|Wrap|Line Numbers
  1. <a href="#">
  2. <input type="image" src="download.gif" onclick="if(confirm('OK?')) return(richiama(this)); return false;"></a>
  3.  
  4. <script language="javascript" type="text/javascript">
  5. <!--
  6.  
  7. var popup = null;
  8.  
  9. function richiama()
  10. {
  11.   var w = 350;
  12.   var h = 350;
  13.  
  14.   var pw = Math.floor((screen.width - w) / 2);
  15.   var ph = Math.floor((screen.height - h) / 2);
  16.  
  17.   if (!popup || popup.closed) 
  18.  popup = window.open("popup.asp", "scelte", "width=" + w + ",height=" + h + ",top=" + ph + ",left=" + pw);
  19.  
  20.   if (popup) popup.focus();
  21. }
  22.  
  23. //-->
  24. </script>
  25.  
May 21 '09 #7
acoder
16,027 Expert Mod 8TB
OK, that's a lot of changes!

You don't need 'this' for the richiama function, so change it to:
Expand|Select|Wrap|Line Numbers
  1. return richiama();
What's the link doing on the first line? What happened to the form?
May 21 '09 #8
viki1967
263 100+
OK many thanks...
In this page the form was deleted because in the popup.asp I ask confirmation download.
The old form is now in the new page popup.asp
May 21 '09 #9
acoder
16,027 Expert Mod 8TB
You're using an input element, so it still needs to be inside form tags.

If you're only going to use it for confirmation/information, use confirm/alert instead of opening a pop-up window.
May 21 '09 #10
viki1967
263 100+
OK, many thanks for your suggestion!
May 22 '09 #11
acoder
16,027 Expert Mod 8TB
No problem. My pleasure.
May 22 '09 #12

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Bob | last post by:
I am trying to create a popup page (to act as a menu) from a parent page. When the parent page (index.jsp) calls my popup function (see below) it will properly open the correct size browser window...
1
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at...
1
by: Josh | last post by:
I've got one user with a problem. All other users are fine. I open a new browser and point it to a CSV file with a XLS extention. Normal users get a prompt about Open or Save, the problem guy...
5
by: Steve | last post by:
Hi, I currently have a problem passing a variable value from one page to another. Once a form submit button is pressed java pops up a window and displays some information. The problem being is...
2
by: rohini | last post by:
Dear friends, In the popup window i am using the header for downloading the files. I call the popup window in one directory say for example: /sample/download/popup.php In the...
6
by: mistral | last post by:
what is correct way open a PDF document in new window use hyperlink? I want show images thumbnails linked with PDF files, when click on thumbnail, PDF will be opened in new window. Some of PDF...
2
by: swethak | last post by:
Hi, I am getting the problem the problem with google map in Internet Explorer. This map worked fine in mozilla . When i opened the same map in Internet Explorer i am getting the error...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.