JavaScript - ¿Como hacer un boton de copy en java script?

 
Vista:

¿Como hacer un boton de copy en java script?

Publicado por Eddy Andujo (1 intervención) el 25/02/2021 00:18:35
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<!DOCTYPE html>
<html>
<head>
</style>
</head>
<body>
<h2>U p d a t e s</h2>
</br> </br>
	<a href="weworking.html"><input type="button" value="  n e w  "></a>
	<a href="updates.html"><input type="button" value="  m o r e  "></a>
	<a href="osa.html"><input type="button" value="  t wo O S A  "></a>
	<a href="index.html"><input type="button" value="  b a c k  "></a>
</br> </br></br> </br>
<ad>Addresses:</ad>
 </br>  </br>
<input type="text" id="text1">
<input type="text" id="desc1">
 </br>  </br>
<input type="text" id="text2">
<input type="text" id="desc2">
<b><button type="button" onclick="finish()">  f i n i s h  </button></b>
<a href="updates.html"><input type="button" value="  c l e a n  "></a>
 </br>  </br>
<input type="text" id="text3">
<input type="text" id="desc3">
</br> </br>
</br>
<p id="date"></p>
 
<script>
var verde =
		[" ",
		"We searched the entire property and the surrounding neighborhood but we could not 		locate the wanted unit.",
		"We were unable to locate the wanted unit on the property or in the surrounding 		neighborhood.",
		"The area was searched with no sign of the wanted unit.",];
 
	var azul =
		[" ",
		"Will continue efforts at various hours and advise of any progress.",
		"Will rerun and advise.",
		"All skip coming up empty, all efforts resume, we will advise.];
function finish() {
	var minverde = 1;
	var maxverde = verde.length - 1;
	var minazul = 1;
	var maxazul = azul.length-1;
	var randomazul =  Math.floor((Math.random() * maxazul) + minazul);
	var randomverde = Math.floor((Math.random() * maxverde) + minverde);
	var randomazul2 =  Math.floor((Math.random() * maxazul) + minazul);
	var randomverde2 = Math.floor((Math.random() * maxverde) + minverde);
	var randomazul3 =  Math.floor((Math.random() * maxazul) + minazul);
	var randomverde3 = Math.floor((Math.random() * maxverde) + minverde);
	var no = verde[randomverde];
	var esf = azul[randomazul];
	var no2 = verde[randomverde2];
	var esf2 = azul[randomazul2];
	var no3 = verde[randomverde3];
	var esf3 = azul[randomazul3];
	var address1 = document.getElementById("text1").value;
	var address2 = document.getElementById("text2").value;
	var address3 = document.getElementById("text3").value;
	var des1 = document.getElementById("desc1").value;
	var des2 = document.getElementById("desc2").value;
	var des3 = document.getElementById("desc3").value;
	var date = new Date();
	var mes = date.getMonth() + 1;
	document.getElementById("date").innerHTML = "" + mes + "/" + date.getDate() + "/" + date.getFullYear()  + "</br>";
	if(address2 != "")
	{
	document.getElementById("num1").innerHTML = "- [" + address1 + "]. " + des1 + no + " " + esf;
	document.getElementById("num2").innerHTML = "- [" + address2 + "]. " + des2 +  no2 + " " + esf2+ "</br>" + "</br>" + "Thank you, Eduardo";
		if (address3 != "")
		{
		document.getElementById("num1").innerHTML = "- [" + address1 + "]. " + des1 + no + " " + esf;
		document.getElementById("num2").innerHTML = "- [" + address2 + "]. " + des2 + no2 + " " + esf2;
		document.getElementById("num3").innerHTML =  "- [" + address3 + "]. " + des3 + no3 + " " + esf3+ "</br>" + "</br>" + "Thank you, Eduardo";
		}
	}
	else
	{
	document.getElementById("num1").innerHTML = "- [" + address1 + "]. " + des1 + no + " " + esf + "</br>" + "</br>" + "Thank you, Eduardo";
	}
}
</script>
<p id = "num1"></p>
<p id = "num2"></p>
<p id = "num3"></p>
</br> </br>  </br>
</body>
</html>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder