Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

change of email domain

Status
Not open for further replies.

Mygurutech

IS-IT--Management
Joined
Mar 24, 2008
Messages
10
Location
NL
Hi,
I need some help
1 textbox mail where you type your email address
1 listbox where you can choose you domain

suppose I need an email address but the domain differs
how can I choose from the list where the domain are registered go into the textbox mail

for example
the listbox containts
yahoo.com
google.com
microsoft.com

when typing into the text name@yahoo.com
and When I choose google.com the textbox value change into name@google.com
the NAME stays as is onthe the domain can change....

how can I do this?
Please advise
Kisoen





 
Investigate the "substr", "substring", and "indexOf" methods of the JavaScript "String" object... that should give you all you need to do this task.

Hope this helps,
Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
maybe this gives you a start in the right direction...
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "[URL unfurl="true"]http://www.w3.org/TR/html4/strict.dtd">[/URL]
<html>
<head>
<title>example page</title>
<script type="text/javascript">
function setNewEmail(){
myName = document.getElementById("myEmail").value;
x = myName.indexOf('@');
if(x==-1){x=myName.length};
myName = myName.substring(0,x) + '@' + document.getElementById("myDomain").value;
document.getElementById("myEmail").value = myName;
}
</script>
</head>
<body>
<p>Your email........<input type="text" id="myEmail"></p>
<p>Select domain.....<select id="myDomain" onChange="setNewEmail();">
			<option value=""><blank></option>
			<option value="yahoo.com">yahoo.com</option>
			<option value="google.com">google.com</option>
			<option value="microsoft.com">microsoft.com</option>
                     </select></p>
</body>
</html>
 
CORRECT this is the script.
just great

thx
kisoen
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top