Forum Moderators: open
first field is called user
and second field is called password
and i also have a hidden field called host
i want the value of the hidden field "host" to change depending on what is entered as the value for "user".
the "user" field is where a user must enter a full email address and based on this i want to set the value of host field to "mail.domain.com"
so for example, if i typed my email address as something@yahoo.com in the user field, then just before i click on login it should set the value of the hidden field "host" to mail.yahoo.com
can anyone please tell me how i can do this, and it needs to be compatible with as many browsers as possible.
<script type="text/javascript">
function myfunction(f) {
var u = f.user.value;
f.host.value = 'mail.' + u.substr(u.indexOf('@')+1);
}
</script>
<form action="..." onsubmit="myfunction(this)">
...