HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
radio button
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form
View previous topic :: View next topic  
Author Message
bj31t



Joined: 02 Oct 2009
Posts: 2

PostPosted: Fri Oct 02, 2009 6:58 am     radio button Reply with quote

is it possible to have a form go to a different email address depending on which radio button is selected? if this is possible could someone help me with the code

thanks
nikki



Joined: 24 Nov 2008
Posts: 132

PostPosted: Fri Oct 02, 2009 9:35 am     Reply with quote

What do you mean by "
Quote:
form go to a different email address
"

Do yo want the page to be redirected to different page depending on the radio button selected or send an email to different email address depending on the radio button selected value ?
bj31t



Joined: 02 Oct 2009
Posts: 2

PostPosted: Fri Oct 02, 2009 9:48 am     Reply with quote

I have 2 radio buttons. when button 1 is selected, it goes to email 1 when the user hits submit. when button 2 is selected, it goes to email 2 when the user hits submit.

thanks
nikki



Joined: 24 Nov 2008
Posts: 132

PostPosted: Tue Oct 27, 2009 4:00 pm     Reply with quote

Code:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script>
   function emailTo(){
      
      var emails = document.getElementsByName("email");
      var emailAdress = null;
      
      for(var i = 0; i < emails.length; i++){
         if(emails[i].checked){
            emailAdress = emails[i].value;
         }
      }
      
      if(emailAdress == null){
         alert("select the email address");
         return;
      }
      
      var mailto_link = 'mailto:'+emailAdress;

       var   win = window.open(mailto_link,'emailWindow');
      if (win && win.open &&!win.closed) win.close();
      
   }
</script>

</head>
<body>


<input type = "radio" name = "email" value = "aatyahoo.com"/>aatyahoo.com
<input type = "radio" name = "email" value = "batyahoo.com">batyahoo.com

<input type = "button" onClick = "emailTo()" value = "Email"/>   
 
</body>
</html>
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> HTML Form All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
DARFUR
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial