Retroceder   Foros del Web > Programación para sitios web > Javascript

Respuesta
 
Herramientas Desplegado
Antiguo 25-mar-2008, 05:47   #1 (permalink)
Silent88 ha deshabilitado el karma
 
Fecha de Ingreso: marzo-2008
Mensajes: 2
Error en codigo Javascript

Hola buenas a todos. Queria pedir ayuda por que no encuentro el error en un codigo y si no es asi no se como tendre que hacerlo, estoy estudiando un modulo medio de informatica y me mandaron una practica y la verdad que llevo bastante tiempo buscando el error o otra manera de hacerla pero no se me ocurre nada y tengo un libro el cual no me resuelve nada.
La foto de la practica la he colgado en la siguiente pagina
http://www.fotazas.com/v2/photo_lzzy2tqqtygkvftmzna5.jpg.htm
no la he subido aqui porque no se veia bien.

Y este es el codigo que yo he puesto:

<HTML>
<HEAD>
<TITLE>Modificacion de formato de texto</TITLE>
</HEAD>
<BODY>
<DIV id="textop" ; font-family: Arial;>
<p id="desc">&nbsp</p>
</DIV>
<br>
<td colspan="2" align="center"> <input name="Alinear" type="button" value="Alinear" onclick="alineartexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Tamaño" type="button" value="Tamaño" onclick="tamañotexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Color fondo" type="button" value="Color fondo" onclick="colorfondo();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Color texto" type="button" value="Color texto" onclick="colortexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Letra texto" type="button" value="Letra texto" onclick="letratexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Estilo" type="button" value="Estilo" onclick="estilotexto();"></td>

<SCRIPT LANGUSGE= "JavaScript">
<!--
var texto = prompt("Introduce un texto","")
document.getElementById("desc").firstChild.nodeVal ue= texto;
var num_colores=0;
{
num_colores++
}
if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function colortexto() {
textop.style.color= "Red";
}
break;
case 2:
function colortexto() {
textop.style.color= "Green";
}
break;
case 3:
function colortexto() {
textop.style.color= "Blue";
}
break;
case 4:
function colortexto() {
textop.style.color= "Orange";
}
break;
case 5:
function colortexto() {
textop.style.color= "Black";
}
break;
}

{
num_colores++
}
if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function colorfondo() {
textop.style.backgroundColor= "Red";
}
break;
case 2:
function colorfondo() {
textop.style.backgroundColor= "Green";
}
break;
case 3:
function colorfondo() {
textop.style.backgroundColor= "Nlue";
}
break;
case 4:
function colorfondo() {
textop.style.backgroundColor= "Orange";
}
break;
case 5:
function colorfondo() {
textop.style.backgroundColor= "Black";
}
break;
}

{
num_colores++
}
if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function letratexto() {
textop.style.fontFamily= "Comic Sans Ms";
}
break;
case 2:
function letratexto() {
textop.style.fontFamily= "Verdana";
}
break;
case 3:
function letratexto() {
textop.style.fontFamily= "Times New Roman";
}
break;
case 4:
function letratexto() {
textop.style.fontFamily= "Vrinda";
}
break;
case 5:
function letratexto() {
textop.style.fontFamily= "SimSun";
}
break;
}

{
num_colores++
}
if(num_colores > 7);
{
switch (num_colores)
{
case 1:
function estilotexto() {
textop.style.fontFamily= "Cursive","Underline";
}
break;
case 2:
function estilotexto() {
textop.style.fontFamily= "Black";
}
break;
case 3:
function estilotexto() {
textop.style.fontFamily= "Cursive";
}
break;
case 4:
function estilotexto() {
textop.style.fontFamily= "Underline";
}
break;
case 5:
function estilotexto() {
textop.style.fontFamily= "Black","Cursive";
}
break;
case 6:
function estilotexto() {
textop.style.fontFamily= "Black","Underline";
}
break;
case 7:
function estilotexto() {
textop.style.fontFamily= "Black","Cursive","Underline";
}
break;
}

{
num_colores++
}
if(num_colores > 5);
{
case 1:
function tamañotexto() {
textop.style.fontSize= "18pt";
}
break;
case 2:
function tamañotexto() {
textop.style.fontSize= "12pt";
}
break;
case 3:
function tamañotexto() {
textop.style.fontSize= "25pt";
}
break;
case 4:
function tamañotexto() {
textop.style.fontSize= "30pt";
}
break;
case 5:
function tamañotexto() {
textop.style.fontSize= "8pt";
}
break;
}

{
num_colores++
}
if(num_colores > 3);
{
case 1:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "3cm";
}
break;
case 2:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "8cm";
}
break;
case 3:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "12cm";
}
break;
}
// -->
</SCRIPT>
</BODY>
</HTML>
Espero vuestros comentarios, gracias ;)
Saludos a todos.
Silent88 está desconectado   Responder Citando
Antiguo 25-mar-2008, 13:07   #2 (permalink)
marcopoloaz06 ha deshabilitado el karma
 
Avatar de marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: Metro Neza,Edo.Méx
Mensajes: 263
Enviar un mensaje por MSN a marcopoloaz06
Re: Error en codigo Javascript

Hola, deberias de leer un manual de javascript
librosweb.es/javascript/

Ahi esta sin error
Código HTML:
<HTML>
<HEAD>
<TITLE>Modificacion de formato de texto</TITLE>
</HEAD>
<BODY>
<DIV id="textop" style=" font-family: Arial;">
<p id="desc"></p>
</DIV>
<br>
<td colspan="2" align="center"> <input name="Alinear" type="button" value="Alinear" onclick="alineartexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Tamaño" type="button" value="Tamaño" onclick="tamañotexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Color fondo" type="button" value="Color fondo" onclick="colorfondo();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Color texto" type="button" value="Color texto" onclick="colortexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Letra texto" type="button" value="Letra texto" onclick="letratexto();"></td>
<br>
<br>
<td colspan="2" align="center"> <input name="Estilo" type="button" value="Estilo" onclick="estilotexto();"></td>

<SCRIPT LANGUAGE= "JavaScript">
<!--
var texto = prompt("Introduce un texto","")
document.getElementById("desc").innerHTML= texto;
var num_colores=0;
textop=document.getElementById("desc");

num_colores++


if(num_colores > 3);
{
switch(num_colores){
case 1:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "3cm";
}
break;
case 2:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "8cm";
}
break;
case 3:
function alineartexto() {
textop.style.textTransform= "uppercase";
textop.style.textIndent= "12cm";
}
break;
}
}

if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function colortexto() {
textop.style.color= "Red";
}
break;
case 2:
function colortexto() {
textop.style.color= "Green";
}
break;
case 3:
function colortexto() {
textop.style.color= "Blue";
}
break;
case 4:
function colortexto() {
textop.style.color= "Orange";
}
break;
case 5:
function colortexto() {
textop.style.color= "Black";
}
break;
}
}

num_colores++

if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function colorfondo() {
textop.style.backgroundColor= "Red";
}
break;
case 2:
function colorfondo() {
textop.style.backgroundColor= "Green";
}
break;
case 3:
function colorfondo() {
textop.style.backgroundColor= "Nlue";
}
break;
case 4:
function colorfondo() {
textop.style.backgroundColor= "Orange";
}
break;
case 5:
function colorfondo() {
textop.style.backgroundColor= "Black";
}
break;
}
}


num_colores++

if(num_colores > 5);
{
switch (num_colores)
{
case 1:
function letratexto() {
textop.style.fontFamily= "Comic Sans Ms";
}
break;
case 2:
function letratexto() {
textop.style.fontFamily= "Verdana";
}
break;
case 3:
function letratexto() {
textop.style.fontFamily= "Times New Roman";
}
break;
case 4:
function letratexto() {
textop.style.fontFamily= "Vrinda";
}
break;
case 5:
function letratexto() {
textop.style.fontFamily= "SimSun";
}
break;
}
}


num_colores++

if(num_colores > 7);
{
switch (num_colores)
{
case 1:
function estilotexto() {
textop.style.fontFamily= "Cursive","Underline";
}
break;
case 2:
function estilotexto() {
textop.style.fontFamily= "Black";
}
break;
case 3:
function estilotexto() {
textop.style.fontFamily= "Cursive";
}
break;
case 4:
function estilotexto() {
textop.style.fontFamily= "Underline";
}
break;
case 5:
function estilotexto() {
textop.style.fontFamily= "Black","Cursive";
}
break;
case 6:
function estilotexto() {
textop.style.fontFamily= "Black","Underline";
}
break;
case 7:
function estilotexto() {
textop.style.fontFamily= "Black","Cursive","Underline";
}
break;
}
}


num_colores++

if(num_colores > 5);
{
switch(num_colores){
case 1:
function tamañotexto() {
textop.style.fontSize= "18pt";
}
break;
case 2:
function tamañotexto() {
textop.style.fontSize= "12pt";
}
break;
case 3:
function tamañotexto() {
textop.style.fontSize= "25pt";
}
break;
case 4:
function tamañotexto() {
textop.style.fontSize= "30pt";
}
break;
case 5:
function tamañotexto() {
textop.style.fontSize= "8pt";
}
break;
}
}


// -->
</SCRIPT>
</BODY>
</HTML>
adios
__________________
Cambia IP Prodigy Auto/Manual/autoBot Un script Greasemonkey bY->marcoPOLO
http://userscripts.org/scripts/show/20617
http://antiemoerickramon.6te.net
marcopoloaz06 está desconectado   Responder Citando
Antiguo 25-mar-2008, 15:22   #3 (permalink)
Silent88 ha deshabilitado el karma
 
Fecha de Ingreso: marzo-2008
Mensajes: 2
Re: Error en codigo Javascript

Muchisims gracias Marcopoloaz06 ya se me ve y sale todo, el unico poblem que engo ahora eske se ve todo pero cuando pulsas mas de un vez no rota se queda en el prmero, por ejmplo no cambia la letra lo diferentes estilos.
Saludos y gracias de nuevo.
Silent88 está desconectado   Responder Citando
Respuesta
No hay votos aún.


Herramientas
Desplegado

Normas de Publicación
No puedes crear nuevos temas
No puedes responder temas
No puedes subir archivos adjuntos
No puedes editar tus mensajes

BB code is Activado
Caritas están Activado
[IMG] está Activado
Código HTML está Desactivado


La Zona horaria es GMT -6. Ahora son las 04:14.


Message Board Statistics

LinkBacks Enabled by vBSEO 3.1.0

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