Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Filling out form from drop down menu

Posted on 2006-06-19
3
Medium Priority
?
235 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 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…
Suggested Courses

810 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