¿Como creo un salto de linea?
Publicado por Javier (22 intervenciones) el 31/03/2022 07:55:01
Hola!! estaba trabajando en este codigo pero por ejemplo donde dice "First paragraph text" quiero agregar mas texto y agregar salto de linea... como es posible? muchas gracias
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
<!DOCTYPE html>
<head>
<link rel="stylesheet" type="text/css" href="css/estilos.css">
<meta charset="utf8">
</head>
<body>
<script>
function myFunction() {
idArray = new Array()
idArray [1] = "First paragraph text"
idArray [2] = "Second paragraph text"
idArray [3] = "Third paragraph text"
idArray [4] = "Fourth paragraph text"
idArray [5] = "Fifth paragraph text"
document.getElementById("select").onclick = myFunction;
randomParagraph = Math.floor(Math.random()*5);
document.getElementById("result").innerHTML = idArray[randomParagraph + 1];
}
</script>
<button onclick="myFunction()" id="select">Pick text</button>
<div class="main">
<p id="result"></p>
</div>
<footer class="footer">Hey</footer>
</body>
</html>
Valora esta pregunta


0