[b]<html>[/b]
[b]<head>[/b]
[b]<script[/b] [maroon]src[/maroon][teal]=[/teal][i][green]"external-file-with-email-addresses.js"[/green][/i][b]></script>[/b]
[b]<script>[/b]
[b]function[/b] [COLOR=orange]fillEmail[/color][teal]([/teal]event[teal])[/teal]
[teal]{[/teal]
[b]var[/b] employee [teal]=[/teal] event [b]instanceof[/b] Event [teal]?[/teal] event[teal].[/teal]target [teal]:[/teal] event
[b]for[/b] [teal]([/teal][b]var[/b] key [b]in[/b] myobject[teal]) {[/teal]
[b]if[/b] [teal]([/teal]myobject[teal].[/teal][COLOR=orange]hasOwnProperty[/color][teal]([/teal]key[teal]) &&[/teal] employee[teal].[/teal]value [teal]==[/teal] myobject[teal][[/teal]key[teal]]) {[/teal]
document[teal].[/teal][COLOR=orange]getElementById[/color][teal]([/teal][i][green]'email'[/green][/i][teal]).[/teal]value [teal]=[/teal] key
[b]return[/b]
[teal]}[/teal]
[teal]}[/teal]
document[teal].[/teal][COLOR=orange]getElementById[/color][teal]([/teal][i][green]'email'[/green][/i][teal]).[/teal]value [teal]=[/teal] [i][green]''[/green][/i]
[teal]}[/teal]
window[teal].[/teal][COLOR=orange]addEventListener[/color][teal]([/teal][i][green]'load'[/green][/i][teal],[/teal] [b]function[/b][teal]() {[/teal]
[b]var[/b] employee [teal]=[/teal] document[teal].[/teal][COLOR=orange]getElementById[/color][teal]([/teal][i][green]'empName'[/green][/i][teal])[/teal]
[COLOR=orange]fillEmail[/color][teal]([/teal]employee[teal])[/teal]
employee[teal].[/teal][COLOR=orange]addEventListener[/color][teal]([/teal][i][green]'change'[/green][/i][teal],[/teal] fillEmail[teal],[/teal] [b]false[/b][teal])[/teal]
[teal]},[/teal] [b]false[/b][teal])[/teal]
[b]</script>[/b]
[b]</head>[/b]
[b]<body>[/b]
[b]<form[/b] [maroon]action[/maroon][teal]=[/teal][i][green]""[/green][/i][b]>[/b]
[b]<label[/b] [maroon]class[/maroon][teal]=[/teal][i][green]"textbox-label"[/green][/i][b]>[/b]Employee Name[b]</label><br />[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][i][green]"text"[/green][/i] [maroon]id[/maroon][teal]=[/teal][i][green]"empName"[/green][/i] [maroon]name[/maroon][teal]=[/teal][i][green]"empName"[/green][/i][b]>[/b]
[b]<br />[/b]
[b]<label[/b] [maroon]class[/maroon][teal]=[/teal][i][green]"textbox-label"[/green][/i][b]>[/b]Email Address[b]</label><br />[/b]
[b]<input[/b] [maroon]type[/maroon][teal]=[/teal][i][green]"email"[/green][/i] [maroon]name[/maroon][teal]=[/teal][i][green]"email"[/green][/i] [maroon]id[/maroon][teal]=[/teal][i][green]"email"[/green][/i][b]>[/b]
[b]<br />[/b]
[b]</form>[/b]
[b]</body>[/b]
[b]</html>[/b]