Ver Mensaje Individual
  #2 (permalink)  
Antiguo 25/03/2008, 13:07
Avatar de marcopoloaz06
marcopoloaz06
 
Fecha de Ingreso: julio-2007
Ubicación: México
Mensajes: 457
Antigüedad: 16 años, 9 meses
Puntos: 11
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
__________________
Aerolíneas Alicia :D