Solved

Filling out form from drop down menu

Posted on 2006-06-19
3
223 Views
Last Modified: 2008-02-01
Hello.

How can the following be adjusted so that when you click on an option in the top menu, the form at the bottom is automatically filled out?

Thanks for the help!



//////////////////////////////////



<script type="text/javascript" src="http://www.php-development.ru/javascripts/dropdown/dropdown.js"></script>

<div>
<div id="menu_parent"
     style="width: 150px; border: 1px solid black; background: #FFFFEE; padding: 0px 5px;
            color: #008000;">
Select One
</div>
<div id="menu_child" style="position: absolute; visibility: hidden; background: #FFFFEE;">
<a style="display: block; width: 300px; border: 1px solid black; padding: 0px 5px; text-decoration: none; color: #0000C0;" href="#">Title: Page 1 - URL: page1.html</a>
<a style="display: block; width: 300px; border: 1px solid black; padding: 0px 5px; text-decoration: none; color: #0000C0;" href="#">Title: Page 2 - URL: page2.html</a>
<a style="display: block; width: 300px; border: 1px solid black; padding: 0px 5px; text-decoration: none; color: #0000C0;" href="#">Title: Page 3 - URL: page3.html</a>
</div>
<script type="text/javascript">
at_attach("menu_parent", "menu_child", "hover", "y", "pointer");
</script>
</div>

<script type="text/javascript">
at_attach("menu_parent", "menu_child", "hover", "y", "pointer");
</script>

<form action="process.php" method="post">
           Title: <input type="text" name="menu_title" value=""> <br>
           URL: <input type="text" name="menu_url" value=""> <br>
<input type=submit>
</table>
</form>
0
Comment
Question by:hankknight
  • 2
3 Comments
 
LVL 63

Accepted Solution

by:
Zvonko earned 500 total points
ID: 16935026
Like this:

<script type="text/javascript" src="dropdown.js"></script>
<style>
#menu_child a {
  display: block;
  width: 300px;
  border: 1px solid black;
  padding: 0px 5px;
  text-decoration: none;
  color: #0000C0;
}
</style>
<script>
function clickLink(theLink){
  var theForm=document.forms[0];
  theForm.menu_title.value=theLink.innerHTML;
  theForm.menu_url.value=theLink.href;
  return false;
}
</script>
<div>
<div id="menu_parent"
     style="width: 150px; border: 1px solid black; background: #FFFFEE; padding: 0px 5px;
            color: #008000;">
Select One
</div>
<div id="menu_child" style="position: absolute; visibility: hidden; background: #FFFFEE;">
<a href="page1.html" onClick="return clickLink(this)">Page 1</a>
<a href="page2.html" onClick="return clickLink(this)">Page 2</a>
<a href="page3.html" onClick="return clickLink(this)">Page 3</a>
</div>
<script type="text/javascript">
at_attach("menu_parent", "menu_child", "hover", "y", "pointer");
</script>
</div>
<br><br><br><br><br><br><br>

<form action="process.php" method="post">
          Title: <input type="text" name="menu_title" value=""> <br>
          URL: <input type="text" name="menu_url" value=""> <br>
<input type=submit>
</table>
</form>


0
 
LVL 16

Author Comment

by:hankknight
ID: 16935414
Thanks!
0
 
LVL 63

Expert Comment

by:Zvonko
ID: 16935436
You are welcome.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

In Part 1 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7849-Hex-Maze.html) we covered the hexagonal maze basics -- how the cells are represented in a JavaScript array and how the maze is displayed.  In this part, we'…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now