Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
Basic_Registration_form
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Thi Thanh Yen Hoang
Basic_Registration_form
Commits
2f5862af
Commit
2f5862af
authored
Jun 23, 2016
by
Thi Thanh Yen Hoang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init project
parents
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
0 deletions
+116
-0
bt.html
+29
-0
javascript.js
+42
-0
stylesheet.css
+45
-0
No files found.
bt.html
0 → 100644
View file @
2f5862af
<!DOCTYPE html>
<html>
<head>
<link
type=
"text/css"
rel=
"stylesheet"
href=
"stylesheet.css"
/>
<title>
Result
</title>
</head>
<body>
<form>
<div><p>
Register Form
</p></div>
<ul>
<li><div
id=
"message"
>
</div></li>
<li><div
class=
label
>
First Name
</div>
<input
type=
"text"
id=
"fname"
placeholder=
"First Name"
value=
""
size=
100%
/></li>
<li><div
class=
label
>
Last Name
</div><input
type=
"text"
placeholder=
"Last Name"
id=
"lname"
value=
""
size=
100%
/></li>
<li><div
class=
label
>
Email
</div>
<input
type=
"text"
placeholder=
"Email"
id=
"email"
value=
""
size=
100%
/></li>
<li><div
class=
label
>
Email Confirmation
</div>
<input
type=
"text"
placeholder=
"Email Confirmation"
id=
"cemail"
value=
""
size=
100%
/></li>
<li><div
class=
label
>
Birthday
</div>
<input
type=
"text"
placeholder=
"Birthday"
id=
"bday"
value=
""
size=
100%
/></li>
</ul>
<button
onclick=
"return validate();"
>
Register
</button>
</form>
<script
src=
"javascript.js"
>
</script>
</body>
</html>
javascript.js
0 → 100644
View file @
2f5862af
function
validate
()
{
//input
var
firstname
=
document
.
getElementById
(
"fname"
).
value
;
var
lastname
=
document
.
getElementById
(
"lname"
).
value
;
var
email
=
document
.
getElementById
(
"email"
).
value
;
var
cemail
=
document
.
getElementById
(
"cemail"
).
value
;
var
bday
=
document
.
getElementById
(
"bday"
).
value
;
var
alphabeta
=
/
[
a-zA-Z
]
+$/
;
var
date
=
/^
((((
0
[
13578
])
|
(
1
[
02
]))[\/]?(([
0-2
][
0-9
])
|
(
3
[
01
])))
|
(((
0
[
469
])
|
(
11
))[\/]?(([
0-2
][
0-9
])
|
(
30
)))
|
(
02
[\/]?[
0-2
][
0-9
]))[\/]?\d{4}
$/
;
var
filter
=
/^
([
a-zA-Z0-9_
\.\-])
+
\@(([
a-zA-Z0-9
\-])
+
\.)
+
([
a-zA-Z0-9
]{2,4})
+$/
;
//message
var
message
=
document
.
getElementById
(
"message"
);
// Validate
if
(
firstname
==
""
||
lastname
==
""
||
email
==
""
||
cemail
==
""
|
bday
==
""
){
message
.
innerHTML
=
"Input Error"
;
message
.
style
.
color
=
"red"
;
return
false
;
}
else
{
if
(
filter
.
test
(
email
)
==
filter
.
test
(
cemail
))
{
if
(
alphabeta
.
test
(
firstname
)
==
true
&&
alphabeta
.
test
(
lastname
)
==
true
&&
date
.
test
(
bday
)
==
true
)
{
alert
(
"Thank for your registering"
);
return
true
;
}
else
{
message
.
innerHTML
=
"Input Error"
;
message
.
style
.
color
=
"red"
;
return
false
;
}
}
else
{
message
.
innerHTML
=
"Input Error"
;
message
.
style
.
color
=
"red"
;
return
false
;
}
}
}
stylesheet.css
0 → 100644
View file @
2f5862af
form
{
margin
:
auto
;
width
:
70%
;
height
:
40%
;
border
:
1px
ridge
gray
;
}
input
{
float
:
right
;
margin-top
:
5px
;
margin-right
:
10px
;
margin-bottom
:
5px
;
position
:
relative
;
}
button
{
margin-top
:
5px
;
margin-right
:
10px
;
margin-bottom
:
5px
;
margin-left
:
300px
;
}
div
p
{
border
:
none
;
text-align
:
center
;
font-size
:
24px
;
}
ul
{
list-style-type
:
none
;
margin-top
:
5px
;
margin-right
:
10px
;
margin-bottom
:
5px
;
}
div
.label
{
width
:
15%
;
float
:
left
;
text-align
:
right
;
margin-top
:
10px
;
margin-right
:
5px
;
margin-bottom
:
10px
;
position
:
relative
;
font-weight
:
bold
;
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment