Click to See Complete Forum and Search --> : Open pdf in new window


anthony76
01-11-2004, 05:53 PM
I want to choose from a select box and open the pdf file - only if selectedIndex!=0 and also I want to open in new window. It works the first time. Then when I close the pdf file - the original html page takes long time to stabilize and the browser closes. I want to have the original page with the selectedIndex set to 0 and also I want to be able to reselect an item an open a new pdf file.
Thanks

Please see my code

<HTML>
<HEAD>
<TITLE>Testing select2</TITLE>
<SCRIPT LANGUAGE="JavaScript">
function showfile(selector) {
if (selector[0].selected!=true) {
var result=selector.options[selector.selectedIndex].text;
var file=selector.options[selector.selectedIndex].value;
window.open().location.href=file;
selector.selectedIndex=0;

}
}
</SCRIPT>
</HEAD>
<BODY>
<FORM METHOD="POST" name="form1">
View orders that have been processed:
<SELECT NAME="appList" onChange="showfile(document.form1.appList)">
<OPTION SELECTED >Choose a category
<OPTION VALUE="erbooks.pdf">ERbooks
<OPTION VALUE="grbooks.pdf">GRbooks
<OPTION VALUE="etables.pdf">Etables
</SELECT>
<!--<INPUT TYPE="button" VALUE="View PDF File" onClick="showfile(appList)"> -->
</FORM>
</BODY>
</HTML>

Kor
01-12-2004, 02:27 AM
But... your script does exactly what you want (IE6 here)... What is, in fact, your problem?

anthony76
01-12-2004, 05:45 AM
When I close the 2nd window (the pdf file) and go to the 1st window - it freezes. I cannot select a new item from the select box - to view the pdf file. Do I have to do a form reload event? It looks like the focus is on the select box.
I am a Newbie!!

Kor
01-12-2004, 06:00 AM
Hm... As I said... For me on my browser IE6 there is no such a problem... I verify and everithing works OK...

And the script looks ok as syntax....

anthony76
01-12-2004, 08:29 AM
Yes I tried it on my computer at work and I have no problem That is - it works fine.
How can I make sure that other public users won't have a problem if their browser is not appropriate? Is there anything I can do? Thanks