-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTask4.js
31 lines (26 loc) · 1.05 KB
/
Task4.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var UserName;
do
{
UserName=prompt("Enter your User Name");
}while(!isNaN(UserName));
var PhoneNumber;
do
{
PhoneNumber=prompt("Enter your Phone Number");
}while(PhoneNumber.length!=8);
var mobileNum;
do{
mobileNum = prompt("Enter you Mobile with 11 number & starts with (010 or 011 r 012)"); //by default string
}
while(!(mobileNum.length == 11 && (mobileNum.startsWith("010") || mobileNum.startsWith("011") || mobileNum.startsWith("012"))) );
var validRegex = /^[a-zA-Z]{3}@[0-9]{3}.com*$/;
var em;
do{
em=prompt("please enter your email ");
}while(!em.match(validRegex))
var choice =prompt("choose color from (red,blue,green)");
document.writeln("<h1>entering user info</h1> <hr>");
document.writeln('<h4 style="color:'+choice+';">Welcome dear guest </h4>'+UserName);
document.writeln('<h4 style="color:'+choice+';">Your telephone number is </h4>'+PhoneNumber);
document.writeln('<h4 style="color:'+choice+';">Your mobile number is </h4>'+mobileNum);
document.writeln('<h4 style="color:'+choice+';">Your email address is</h4>'+em);