
cambiar atributos de texto desde funcion
Publicado por Enrique (22 intervenciones) el 30/05/2015 02:34:01
Este código debe cambiar las propiedades de texto de un <div> según el botón que se pulse, al pulsar los botones no hace nada, entré a las herramientas para desarrolladores del navegador de internet para debugear el código y cada vez que pulso alguno de los tres botones me marca alguno de estos errores según en botón pulsado.
Uncaught ReferenceError: cambiarColor is not defined
Uncaught ReferenceError: cambiarTamaño is not defined
Uncaught ReferenceError: cambiarEstilo is not defined
¿En que estoy mal?
Uncaught ReferenceError: cambiarColor is not defined
Uncaught ReferenceError: cambiarTamaño is not defined
Uncaught ReferenceError: cambiarEstilo is not defined
¿En que estoy mal?
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Cambiar propiedades del texto</title>
<script languaje="javascript">
</script>
</head>
<body>
<div id="miDiv">ESTE TEXTO DEBE DE CAMBIAR AL PRESIONAR LOS BOTONES</div>
<br>
<input type="button" value="color" onclick="cambiarColor()"/>
<input type="button" value="tamaño" onclick="cambiarTamaño()"/>
<input type="button" value="Estilo" onclick="cambiarEstilo()"/>
<script languaje="javascript">
function cambiarColor(){
document.getElementById('miDiv').style.color="#96ad3a";
}
function cambiarTamaño(){
document.getElementById('miDiv').style.font-size="40px";
}
function cambiarEstilo(){
document.getElementById('miDiv').style.decoration="underline";
}
<script>
</body>
</html>
Valora esta pregunta


0