I'm stumped. I've googled this until I lost consciousness and cannot find an answer. I'm trying to write a specific anchor/link depending upon the option selected from a drop-down list. The link from the image is to a pdf file. Can someone point me in the right direction?
Here is my code:
Code:<script type="text/javascript"> function getScorecard(sel) { //create the scorecard node var myA=document.createElement("A"); var myImg=document.createElement("IMG"); var url = "http://14holegolf.googlepages.com/Birecree-Contestable.pdf"; myA.setAttribute("href",url); //create the image node url = "http://14holegolf.googlepages.com/Birecree-Contestable.jpg"; var myImg=document.createElement("IMG"); myImg.setAttribute("src",url); // Append the image node to the anchor myA.setAttribute("img", myImg); document.getElementById('targetDiv').appendChild(myA); } </script>HTML Code:<form action="" method="post"> <table align="center" border="0" cellpadding="8" width="680"> <tbody> <tr> <td align="right"><b>Team:</b></td> <td align="left"><select name="team" onchange="getScorecard(this)"> <option value="" selected>Select a team</option> <option value="1">Option 1</option> <option value="2">Option 2</option> </select> </td> </tr> <tr> <td colspan="3" <div id="targetDiv"></div> </td> </tr> </tbody> </table> </form>


Reply With Quote
Bookmarks