JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 28th, 2000, 03:45 PM
rkmarcks rkmarcks is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 81 rkmarcks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via AIM to rkmarcks
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?

Reply With Quote
  #2  
Old May 29th, 2000, 07:11 AM
firepages's Avatar
firepages firepages is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Feb 2000
Location: Perth West Australia
Posts: 741 firepages User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
need to see your script


------------------
Simon Wheeler
FirePages -DHTML/PHP/MySQL

Reply With Quote
  #3  
Old May 29th, 2000, 01:39 PM
rkmarcks rkmarcks is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2000
Posts: 81 rkmarcks User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 9
Send a message via AIM to rkmarcks
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">&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>


Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Using javascript to invoke a download


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway