JavaScript Program to Create Email ID from name

Write a JavaScript program to create email id after entering first name, middle name and surname.

Write html script that displays textboxes for accepting name, middlename, surname of the user and a submit button. Write proper JavaScript such that when the user clicks on submit button. i) all texboxes must get disabled and change the color to “red”. and with respective labels. ii) constructs the mailid as and displays mail id as message. (ex. if user enters rajni as name and pathak as surname mailid will be constructed as .

Source Code
    <title>Create MSBTE email id</title>
        function constructMailId()
            var fn = document.getElementById('fname').value
            var sn = document.getElementById('sname').value
            var email = fn.toLowerCase() + "." + sn.toLowerCase() + ""
            alert('Your mailID is: ' + email)
<form name="myform">
First name <input type="text" id="fname"/><br/>
Surname <input type="text" id="sname"/><br/>
<input type="button" value="Submit" onclick="constructMailId()"/>