slovey Posted July 28, 2015 Share Posted July 28, 2015 I want to have a drop down which then causes a pdf to display based on drop down value. I have tried something like this - see attached I know this won't work but have no idea where to go. I tried php but can't seem to make it work on my server. thanks for you help Test10.htm Quote Link to comment https://forums.phpfreaks.com/topic/297528-drop-down-to-display-pdf-file/ Share on other sites More sharing options...
hansford Posted September 6, 2015 Share Posted September 6, 2015 I don't know what you plan on loading the pdf file into. I used an iframe as an example. If you wanted the whole page to open the pdf file you could just use: document.location = selection; <H3><B>My Notes</B></H3> <select name="mymonth" id="mymonth"> <option value="" selected>Select Pdf File</option> <option value="FF_Mar06.pdf">Mar 20</option> <option value="FF_Mar13.pdf">Mar 13</option> <option value="NotAvail.pdf">Mar 06</option> </select> <script type="text/javascript"> var pdfSelect = document.getElementById('mymonth'); pdfSelect.addEventListener('change', function() { var selection = this.options[this.selectedIndex].value; var frame = document.getElementById('pdf_frame'); frame.src = selection; }); </script> <br /> <iframe id="pdf_frame" src="" width="100%"></iframe> </body> Quote Link to comment https://forums.phpfreaks.com/topic/297528-drop-down-to-display-pdf-file/#findComment-1520385 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.