Solved

Filling out form from drop down menu

Posted on 2006-06-19
3
226 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…

829 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