AndrewAK Posted January 28, 2008 Share Posted January 28, 2008 I'm experiencing "code-lock" Is it even possible to put an <a> element within an <option> element that is a part of a <select> element?As far as I can work the logic, it would look somthing like the following code: <select id="somename"><option><a href="some url">Some Text</a></option></select> I've tried to get this to work and can't make it happen.Am I missing somthing?I have read about XHTML/HTML Events like "onclick" but can't remember how to use it to load a file from a known location.I should explain myself further. The ultimate goal here is to load a PDF file into the browser with a link that is within the <select> element. Link to comment Share on other sites More sharing options...
justsomeguy Posted January 28, 2008 Share Posted January 28, 2008 Option elements can't have child elements, only text. If you want to have a select element that goes to a file on change you can put the URL into the value of the option and write it like this:<select onchange="window.location.href=this.value"><option value="file1.pdf">file 1</option><option value="file2.pdf">file 2</option></select> Link to comment Share on other sites More sharing options...
AndrewAK Posted January 29, 2008 Author Share Posted January 29, 2008 Thanks a bunch, that work perfectly! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.