Hi, I have text on a page Env Lei Tour I want to make these place a select box next to it when its clicked. ie one clicks on Env and next to it will appear a select box and only next to Env. i guess the ahref will have to be a javascript command, i am just not sure how to do this Please help
<script type="text/javascript"> <!-- function display_select(id) { var objects = new Array('env', 'lei', 'tour'); for (var i in objects) { var element = document.getElementById(objects[i]); element.style.display = element.id == id ? 'block' : 'none'; } return false; } //--> </script> <p> <a href="#" onclick="return display_select('env');">Env</a> <div id="env" style="display: none;"> <select> <option>Env</option> </select> </div> </p> <p> <a href="#" onclick="return display_select('lei');">Lei</a> <div id="lei" style="display: none;"> <select> <option>Lei</option> </select> </div> </p> <p> <a href="#" onclick="return display_select('tour');">Tour</a> <div id="tour" style="display: none;"> <select> <option>Tour</option> </select> </div> </p> Code (markup):
That is cool, thanks one thing, i wanna make it on the same line i tried this.. <a href="#" onclick="return display_select('tour');">Tour</a> <span id="tour" style="display:none;"> <select> <option>Tour</option> </select> </span> but it still puts the select box on a new line... is there any way of doing this without using floats?
This should do it. <table border="0"> <tr> <td><a href="#" onclick="return display_select('env');">Env</a></td> <td><div id="env" style="display: none;"> <select> <option>Env</option> </select> </div> </td> </tr> <tr> <td><a href="#" onclick="return display_select('lei');">Lei</a></td> <td><div id="lei" style="display: none;"> <select> <option>Lei</option> </select> </div> </td> </tr> <tr> <td><a href="#" onclick="return display_select('tour');">Tour</a></td> <td><div id="tour" style="display: none;"> <select> <option>Tour</option> </select> </div> </td> </tr> </table> Code (markup):