|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
I have a situation where if a user clicks on a hyperlink, the action taken is either a pop-up window, a view pdf file, or a download based on the value of a set of radio buttons. The first two are no problem. However, when a file download occurs, I also get a blank pop-up window. How do I let javascript ask for a file download without the window popping up?
|
|
#2
|
||||
|
||||
|
need to see your script
------------------ Simon Wheeler FirePages -DHTML/PHP/MySQL |
|
#3
|
|||
|
|||
|
Here's the script and the relevant HTML. Thanks for looking at it.
<script language="JavaScript"> <!-- var path; var ext; var win1; var title = "Course Description"; var detail = "width=515,height=315,resize=no,scrollbars=no"; function dfn(pt,ttl,dtl) {if(ext == ".rtf" | | ext == "c.rtf") {new Object = pt; //THIS IS THE LINE I'M HAVING PROBLEMS WITH win2 = pt.open;} //WHAT'S SHOWN IS ONE OF THE MANY THINGS I'VE TRIED. else {win1=window.open(pt,ttl,dtl);} } function dothis() { {if (document.forms[0].elements.dowhat[0].checked == true) {path="coursedesc/"; ext=".htm";} else if (document.forms[0].elements.dowhat[1].checked == true) {path="mastersyllabii/"; ext=".pdf";} else if (document.forms[0].elements.dowhat[2].checked == true) {path="coursesyllabii/"; ext="c.pdf";} else if (document.forms[0].elements.dowhat[3].checked == true) {path="mastersyllabii/"; ext=".rtf";} else {path="coursesyllabii/"; ext="c.rtf";} } return path,ext; } // --> </script> . .HTML . . . .RADIO BUTTONS . <form method="post"> <table width="100%" border="0"> <tr> <td width="50%" valign="top"> <p><font face="Arial, Helvetica, sans-serif" size="2" color="#004C00"> <u>View</u><br> <input type="radio" name="dowhat" onclick="form.dowhat.value='viewd';" value="viewd" checked>Course Description and Learning Outcomes<br> <input type="radio" name="dowhat" value="viewm" onClick="form.dowhat.value='viewm';">Master Syllabus (Acrobat Reader Required)<br> <input type="radio" name="dowhat" value="viewc" onclick="form.dowhat.value='viewc';">Course Syllabus (Acrobat Reader Required)</font></p> </td> <td width="50%" valign="top"> <font face="Arial, Helvetica, sans-serif" size="2" color="#004C00"> <u>Download</u><br> <input type="radio" name="dowhat" value="dwnldm" onclick="form.dowhat.value='dwnldm';">Master Syllabus (RTF Format) <br> <input type="radio" name="dowhat" value="dwnldc" onclick="form.dowhat.value='dwnldc';">Course Syllabus (RTF Format) <br> </font></td> </tr> </table> </form> . .HTML . <table width="100%" border="0" cellpadding="0" cellspacing="0"> . .TABLE ENTRIES . <tr> <td width="48%" height="24"> <div align="left"><a href="javascript:;" onclick="javascript (win1)?win1.close():x=1);dothis();(dfn(path+'m106'+ext,title,detail))"><font face="Arial, Helvetica, sans-serif" size="2" color="#004C00">MET 106 Survey of Commercial HVAC Systems</font></a></div> </td> . .TABLE ENTRIES . </tr> <tr> MORE STUFF </tr> </table> </body> </html> |
![]() |
| Viewing: Dev Shed Forums > Web Design > JavaScript Development > Using javascript to invoke a download |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|