#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    81
    Rep Power
    15
    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. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    Perth West Australia
    Posts
    757
    Rep Power
    15
    need to see your script


    ------------------
    Simon Wheeler
    FirePages -DHTML/PHP/MySQL
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2000
    Posts
    81
    Rep Power
    15
    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" &#0124; &#0124; 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">&nbsp;&nbsp;&nbsp;&nbsp;<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">&nbsp;&nbsp;&nbsp;&nbsp;<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>

Similar Threads

  1. Replies: 26
    Last Post: August 9th, 2005, 03:14 PM
  2. External JavaScript file from within a JavaScript function?
    By DKDiveDude in forum JavaScript Development
    Replies: 10
    Last Post: August 19th, 2003, 04:24 AM
  3. javascript: links dead in IE6 and NS4.77
    By hurricaneone in forum JavaScript Development
    Replies: 6
    Last Post: April 11th, 2003, 10:12 PM
  4. download system
    By wilkas in forum PHP Development
    Replies: 11
    Last Post: March 27th, 2003, 04:02 PM
  5. Replies: 1
    Last Post: July 17th, 1999, 05:10 PM

IMN logo majestic logo threadwatch logo seochat tools logo