-
Notifications
You must be signed in to change notification settings - Fork 0
/
examplePage.html
49 lines (35 loc) · 1.3 KB
/
examplePage.html
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>ORCID Example</title>
<script src="lib/orcid.min.js" type="module"></script>
</head>
<body>
<input title="Enter your ORCID Number" type="text" id="orcidTextInput">
<input type="button" value="Validate" onClick="validateAndLog();">
<script>
var validateAndLog = function validateAndLog() {
var orcidNumber = document.getElementById('orcidTextInput').value;
if (ORCID.isValid(orcidNumber)) {
console.log(ORCID.toDashFormat(orcidNumber));
// 0000-0000-0000-0001
console.log(ORCID.toNoDashFormat(orcidNumber));
// 0000000000000001
console.log(ORCID.toUriWithoutProtocol(orcidNumber));
// orcid.org/0000-0000-0000-0001
console.log(ORCID.toUriWithProtocol(orcidNumber));
// https://orcid.org/0000-0000-0000-0001
// toUriWithProtocol also takes a boolean parameter that
// specifies whether the URI should use https or not.
console.log(ORCID.toUriWithProtocol(orcidNumber, true));
// https://orcid.org/0000-0000-0000-0001
console.log(ORCID.toUriWithProtocol(orcidNumber, false));
// http://orcid.org/0000-0000-0000-0001
} else {
console.log('Not Valid');
}
};
</script>
</body>
</html>