Hi All.
I posted on here yesterday but somehow my post isnt appearing. So here goes again. I am new to these forums and also new to javascript so probably made some glaring errors..be gentle with me.
so i am trying to acheive the following.
create a window with a dropdown menu in it, which has a list of options in it (obviously). You then select the option you require (which links to a pdf) and click on a button to open in a new window, or to save the file locally, to save loading time into pdf viewer. There is a third button to close this window.
My code so far works great opening the pdf in a new window, but alas i cannot get it to use the same file to save as locally.
Any help, suggestions or otherwise greatly appreciated.
Code so far..
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<script language=”JavaScript” type=”text/JavaScript”>
<!–
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+”.location='”+selObj.options[selObj.selectedIndex].value+”‘”);
if (restore) selObj.selectedIndex=0;
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf(“?”))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//–>
</script>
</head>
<body>
<p><font size=”2″ face=”Arial, Helvetica, sans-serif”><img src=”images/Logo.gif” width=”150″ height=”63″></font></p>
<p><font size=”2″ face=”Arial, Helvetica, sans-serif”>Select the pdf you wish
to view or save. Clicking View opens PDF in a new browser window.</font></p>
<p><font size=”2″ face=”Arial, Helvetica, sans-serif”>
<select name=”menu2″ size=”1″>
<option Value=”menujumper.htm” selected>Choose PDF to open..
<option value=”document1.pdf”>option1
<option value=”document2.pdf”>option2
<option value=”documentn.pdf”>optionn
</select>
<input type=”button” name=”Button2″ onClick=”MM_jumpMenuGo(‘menu2′,’window.open()’,1)” value=”View”>
</font></p>
<p> </p>
<p> </p>
<p> </p>
<p align=”right”><font size=”2″ face=”Arial, Helvetica, sans-serif”>
<input type=”button” name=”Button4″ value=”Close Window” onClick=”javascript:window.close()”>
</font></p>
<p> </p>
</body>
</html>
Thanks for looking if you got this far.