SitePoint Sponsor |
|
User Tag List
Results 1 to 5 of 5
Thread: Goober Suggested...
Hybrid View
-
Apr 10, 2001, 19:07 #1
...that I post this question here.
This is probably such a newbie question, but how do you set up a form so if one option is selected out of 2 more, the form is sent to that person selected?
-
Apr 10, 2001, 20:27 #2
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Goober was right.
Try something like this:
<html>
<head>
<title>Send Email</title>
<script language="JavaScript">
<!--
function sendForm() {
document.myForm.action = 'mailto:' + document.myForm.nameList[document.myForm.nameList.selectedIndex].value
myForm.submit();
}
// -->
</script>
</head>
<body>
<form name="myForm" method="post" onSubmit="return sendForm();">
<select name="nameList">
<option value="mo@mo.com">mo</option>
<option value="larry@larry.com">larry</option>
<option value="curly@curly.com">curly</option>
<input type="submit" name="submit" value="Send Email">
</form>
</body>
</html>
It uses a select menu, but could just as easily be adapted for radio buttons or whatever else.
-
Apr 10, 2001, 20:31 #3
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Shame on me. I didn't close my <select> tag.
-
Apr 11, 2001, 12:42 #4
Thanks scrubz!
Cute avatar.
-
Apr 11, 2001, 13:30 #5
- Join Date
- Feb 2001
- Location
- Van down by the river
- Posts
- 254
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
No problem, emmester. And since you mentioned it, the avatar is actually me at 7 months of age, with a wig on (compliments of my older siblings).
Bookmarks