Hirdetés
- OLED TV topic
- AMD Ryzen 9 / 7 / 5 9***(X) "Zen 5" (AM5)
- Házimozi haladó szinten
- Fejhallgató erősítő és DAC topik
- Házi barkács, gányolás, tákolás, megdöbbentő gépek!
- Bluetooth hangszórók
- Kinéztél egy RTX 5060 Ti-t? Lehet, jobb, ha lecsapsz rá!
- Kezdő fotósok digitális fényképei
- Milyen monitort vegyek?
- Kompakt vízhűtés
Új hozzászólás Aktív témák
-
válasz
Meggyi001
#21292
üzenetére
Bocsi, nem formáztam
<!DOCTYPE html><html><head><style>.news-container {display: flex;justify-content: flex-end;align-items: center;height: 50px;background-color: lightgray;}.news-item {padding: 10px;font-size: 20px;color: black;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}</style></head><body><div class="news-container"><marquee class="news-item" behavior="scroll" direction="left">News Item 1 | News Item 2 | News Item 3</marquee></div></body></html>
--------------------------<!DOCTYPE html><html><head><style>.news-container {display: flex;justify-content: flex-end;align-items: center;height: 50px;background-color: lightgray;}.news-item {padding: 10px;font-size: 20px;color: black;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}</style></head><body><div class="news-container"><marquee class="news-item" behavior="scroll" direction="left" id="news-item">Loading news...</marquee></div><script>// Fetch the CNN news from an APIconst apiUrl = "https://api.example.com/cnnnews";fetch(apiUrl).then(response => response.json()).then(data => {// Update the news item text with the fetched newsconst newsItem = document.getElementById("news-item");newsItem.innerText = `CNN Breaking News: ${data.breakingNews} | CNN Latest Headlines: ${data.latestHeadlines}`;}).catch(error => {console.error("Error fetching CNN news:", error);});</script></body></html>------------------------------
<!DOCTYPE html><html><head><style>.news-container {display: flex;justify-content: flex-end;align-items: center;height: 50px;background-color: lightgray;}.news-item {padding: 10px;font-size: 20px;color: black;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}</style></head><body><div class="news-container"><marquee class="news-item" behavior="scroll" direction="left" id="news-item">Loading news...</marquee></div><script>// Fetch the Google news from the APIconst apiUrl = "https://news.google.com/home?hl=hu&gl=HU&ceid=HU:hu";fetch(apiUrl).then(response => response.text()).then(data => {// Parse the fetched data to extract the news headlinesconst parser = new DOMParser();const htmlDocument = parser.parseFromString(data, "text/html");const headlines = htmlDocument.querySelectorAll(".pg-c:not(.pg-c-t)");// Concatenate the headlines into a single stringconst headlinesText = Array.from(headlines).map(headline => headline.textContent.trim()).join(" | ");// Update the news item text with the fetched headlinesconst newsItem = document.getElementById("news-item");newsItem.innerText = headlinesText;}).catch(error => {console.error("Error fetching Google news:", error);});</script></body></html> -
Helló skacok. Lenne egy kérdésem. Van arra megoldás, hogy ebben a kódban friss élő hírek fussanak a "News Item 1 | News Item 2 | News Item 3" helyett? Remélem, hogy csináltatok már ilyet...köszi, ha tudtok adni tanácsot.
<!DOCTYPE html>
<html>
<head>
<style>
.news-container {
display: flex;
justify-content: flex-end;
align-items: center;
height: 50px;
background-color: lightgray;
}
.news-item {
padding: 10px;
font-size: 20px;
color: black;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div class="news-container">
<marquee class="news-item" behavior="scroll" direction="left">
News Item 1 | News Item 2 | News Item 3
</marquee>
</div>
</body>
</html>Adott 1-2 tippet a chatgpt, de nem akarnak működni, vagy valamit rosszul csinálok...
<!DOCTYPE html>
<html>
<head>
<style>
.news-container {
display: flex;
justify-content: flex-end;
align-items: center;
height: 50px;
background-color: lightgray;
}
.news-item {
padding: 10px;
font-size: 20px;
color: black;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div class="news-container">
<marquee class="news-item" behavior="scroll" direction="left" id="news-item">
Loading news...
</marquee>
</div>
<script>
// Fetch the CNN news from an API
const apiUrl = "https://api.example.com/cnnnews";
fetch(apiUrl)
.then(response => response.json())
.then(data => {
// Update the news item text with the fetched news
const newsItem = document.getElementById("news-item");
newsItem.innerText = `CNN Breaking News: ${data.breakingNews} | CNN Latest Headlines: ${data.latestHeadlines}`;
})
.catch(error => {
console.error("Error fetching CNN news:", error);
});
</script>
</body>
</html>vagy ezt:
<!DOCTYPE html>
<html>
<head>
<style>
.news-container {
display: flex;
justify-content: flex-end;
align-items: center;
height: 50px;
background-color: lightgray;
}
.news-item {
padding: 10px;
font-size: 20px;
color: black;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
</style>
</head>
<body>
<div class="news-container">
<marquee class="news-item" behavior="scroll" direction="left" id="news-item">
Loading news...
</marquee>
</div>
<script>
// Fetch the Google news from the API
const apiUrl = "https://news.google.com/home?hl=hu&gl=HU&ceid=HU:hu";
fetch(apiUrl)
.then(response => response.text())
.then(data => {
// Parse the fetched data to extract the news headlines
const parser = new DOMParser();
const htmlDocument = parser.parseFromString(data, "text/html");
const headlines = htmlDocument.querySelectorAll(".pg-c:not(.pg-c-t)");
// Concatenate the headlines into a single string
const headlinesText = Array.from(headlines)
.map(headline => headline.textContent.trim())
.join(" | ");
// Update the news item text with the fetched headlines
const newsItem = document.getElementById("news-item");
newsItem.innerText = headlinesText;
})
.catch(error => {
console.error("Error fetching Google news:", error);
});
</script>
</body>
</html>
Új hozzászólás Aktív témák
- Új és régi konzolok Okosítása/Softmodoloása, és Szoftveres szintű javítása - RÉSZLETEK A LEÍRÁSBAN
- Kuriózum: Ozark Trail (amerikai) fejlámpa 600 lumen
- iPhone 13 mini 128GB Green -1 ÉV GARANCIA -Kártyafüggetlen, MS3897, 100% Akkumulátor
- Nagyakkus, mobilnetes - Dell Latitude 5330 i3-1215U 6mag! 16GB 512GB 13.3" FHD 1 év gar
- Telefon felvásárlás!! iPhone 11/iPhone 11 Pro/iPhone 11 Pro Max
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest


