Maria return javaScript!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<style>
h1{
color:#D2691E;
}
h2{
color:#DC143C;
background-color:#FFB6C1;
}
pre{
color:#0000CD;
background-color:black;
font-size:16px;
}
</style>
</head>
<body>
<h1>Como usar return javascript. Imaginação! REALIDADE.</h1>
<p id="demo"></p>
<p id="demo1"></p>
<script>
function criarVariados(){
return ['Você é linda.', 'Quantos anos você tem?', 23*2, 'Você tem 46 anos'
];
}
var valores = criarVariados();
document.getElementById('demo').innerHTML = valores.join('<br>');
function personagem(){
return'<h2>Criar personagem</h2><pre>Eu sou a Maria do javascript.<br><br>Vou criar um verso para VC.<br>Que seja em chegar,<br>amor em verdade de amar. Em condição,<br>ser espírito.<br>Amando com o coração.<br>Amor a verdadeira condição.<br><img src="https://media.tenor.com/Vfo1z-gQIi4AAAAC/stigma-pack.gif"width="100%"><br>Jesus o santo salvador!</pre>';
}
document.getElementById('demo1').innerHTML = personagem();
</script>
</body>
</html>
-------------------------------------
Request fetch function automatic.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe id="demo" src="https://livrosaartedoespirito.blogspot.com/" width="100%" height="300"></iframe>
<input type="button" onclick="changeSrc()" value="Clique em mim"/>
<script>
function changeSrc() {
fetch('https://www.bing.com/?toWww=1&redig=C05976A974CE48EBB786D69DBFD9DAB7')
.then(response => {
if (response.ok) {
document.getElementById('demo').src = "https://www.bing.com/?toWww=1&redig=C05976A974CE48EBB786D69DBFD9DAB7";
} else {
console.error('Erro ao carregar o site.');
}
})
.catch(error => {
console.error('Erro ao carregar o site:', error);
});
}
// Adicionando setInterval para mudar o src automaticamente a cada 10 segundos
setInterval(changeSrc, 10000); // 10000 milissegundos = 10 segundos
</script>
</body>
</html>
---------------------------------
Request varios sites
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<iframe id="demo" src="https://livrosaartedoespirito.blogspot.com/" width="100%" height="300"></iframe>
<input type="button" onclick="changeSrc()" value="Clique em mim"/>
<p id="demo23"></p>
<script>
let sites = [
"https://www.bing.com/?toWww=1&redig=C05976A974CE48EBB786D69DBFD9DAB7",
"https://www.google.com",
"https://www.yahoo.com",
"https://edition.cnn.com/",
"https://www.nytimes.com/",
"https://www.washingtonpost.com/",
"https://duckduckgo.com/?q=v&ia=web",
"https://www.fcia.org/",
"https://yandex.ru/yandsearch?clid=45370&text=uy&lr=10478",
"https://www.bing.com/images/search?form=MXB004&pc=MXBR&q=uy&first=1",
"https://www.boc.cn/en/"
];
let currentSiteIndex = 0;
function changeSrc() {
fetch(sites[currentSiteIndex])
.then(response => {
if (response.ok) {
document.getElementById('demo').src = sites[currentSiteIndex];
currentSiteIndex = (currentSiteIndex + 1) % sites.length; // Avança para o próximo site na lista
} else {
console.error('Erro ao carregar o site.');
}
})
.catch(error => {
console.error('Erro ao carregar o site:', error);
});
}
// Adicionando setInterval para mudar o src automaticamente a cada 10 segundos
setInterval(changeSrc, 10000); // 10000 milissegundos = 10 segundos
</script>
</body>
</html>
Comentários
Enviar um comentário