Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 25e8df2

Browse files
Merge pull request #38 from AzharAli-github/main
Web-API
2 parents 142a756 + 5e2baca commit 25e8df2

File tree

3 files changed

+55
-0
lines changed

3 files changed

+55
-0
lines changed
4.15 KB
Loading[フレーム]
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
7+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
8+
<title>Web-API-Inro</title>
9+
<link rel="shortcut icon" href="images/js-logo.png" type="image/x-icon">
10+
</head>
11+
12+
<body>
13+
<h1>Web API Intoduction</h1>
14+
<p id="textOne"></p>
15+
<button onclick="DisplayOne()">Click to View Doc</button>
16+
<h2>Example</h2>
17+
<button onclick="getLocation()">Get Location</button>
18+
<p id="textTwo"></p>
19+
<script src="script.js"></script>
20+
</body>
21+
22+
</html>
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
// Mention All the Documents and Info about Web API's
2+
let textOne = document.getElementById('textOne');
3+
4+
function DisplayOne() {
5+
textOne.innerHTML = `
6+
<h3>A Web API is a developer's dream.</h3>
7+
<li>It can extend the functionality of the browser</li>
8+
<li>It can greatly simplify complex functions</li>
9+
<li>It can provide easy syntax to complex code</li>
10+
<h1>What is Web API?</h1>
11+
<p>API stands for Application Programming Interface.</p>
12+
<p>A Web API is an application programming interface for the Web.</p>
13+
<p>A Browser API can extend the functionality of a web browser.</p>
14+
<p>A Server API can extend the functionality of a web server.</p>
15+
`
16+
}
17+
18+
19+
// Example For Understanding Web API
20+
21+
let textTwo = document.getElementById('textTwo');
22+
23+
function getLocation() {
24+
try {
25+
navigator.geolocation.getCurrentPosition(showLocation);
26+
} catch {
27+
textTwo.innerHTML = "Error Just Happened";
28+
}
29+
}
30+
31+
function showLocation(position) {
32+
textTwo.innerHTML = "Latitude= " + position.coords.latitude + "<br> Longitude= " + position.coords.longitude;
33+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /