-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnewsguest.php
More file actions
76 lines (69 loc) · 2.82 KB
/
Copy pathnewsguest.php
File metadata and controls
76 lines (69 loc) · 2.82 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="home.css">
<style>
html{
background: #262626;
}
</style>
<script>
function loadNews(){
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
var newsjson = JSON.parse(this.responseText);
for(var i=0; i<newsjson.articles.length-1; ++i){
//if(newsjson.articles[i].source.name=="TechCrunch"){
arts= newsjson.articles[i].title;
document.getElementById("vergenews").innerHTML += "<div class='art-boxed'>" + newsjson.articles[i].title +"</div> <br>";
//}
}
}
};
xhttp.open("GET", "https://newsapi.org/v2/top-headlines?sources=the-verge&apiKey=091bc7dbcc53498eba20900e0f1974e5");
xhttp.send();
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(this.readyState == 4 && this.status == 200){
var newsjson = JSON.parse(this.responseText);
for(var i=0; i<newsjson.articles.length-1; ++i){
//if(newsjson.articles[i].source.name=="TechCrunch"){
arts= newsjson.articles[i].title;
document.getElementById("polygonnews").innerHTML += "<div class='art-boxed'>" + newsjson.articles[i].title +"</div> <br>";
//}
}
}
};
xhttp.open("GET", "https://newsapi.org/v2/top-headlines?sources=polygon&apiKey=091bc7dbcc53498eba20900e0f1974e5");
xhttp.send();
}
</script>
</div>
<div id="box5">
<div class="topnav" id= "navbar">
<!-- Centered link -->
<div class="topnav-centered">
<a href="guesthome.php" class="active"><img src="omnigames logo.png" width="60" height="37.5"></a>
</div>
<!-- Left-aligned links (default) -->
<a href="pongguest.php">Pong</a>
<a href="snakeguest.php">Snake</a>
<a href="tetrisguest.php">Tetris</a>
<!-- Right-aligned links -->
<div class="topnav-right">
<a href="newsguest.php">Hello user1</a>
<a href="contactguest.php">About Us</a>
</div>
</div>
</div>
</head>
<body onload="javascript:loadNews()">
<h1 style="margin:auto; font-size:70px; color:white">Tech & Gaming News:</h1>
<h2 style="color:white;">The Verge News:</h2>
<div id="vergenews"></div>
<hr style="margin-top:85px; color:white">
<h2 style="color:white;">Polygon News</h2>
<div id="polygonnews"></div>
</body>
</html>