Documentos de Académico
Documentos de Profesional
Documentos de Cultura
HTML
HTML
<html>
<head>
<script language="JavaScript">
function sumar()
{
a=document.form1.text1.value;
b=document.form1.text2.value;
c=parseInt(a)+parseInt(b);
document.form1.text3.value=c;
}
</script>
</head>
<body>
<form name="form1" method="post" action="">
<p>
<input type="text" name="text1">
+
<input type="text" name="text2">
=
<input type="text" name="text3">
</p>
<p>
<input name="Submit" type="button" value="sumar" onClick="sumar();">
</p>
</form>
</body>
</html>
ja = cad.split("o");
with(document) {
write("La cadena es: "+cad+"<BR>");
write("Longitud de la cadena: "+cad.length+"<BR>");
write("Haciendola ancla: "+cad.anchor("b")+"<BR>");
write("En grande: "+cad.big()+"<BR>");
write("Parpadea: "+cad.blink()+"<BR>");
write("Caracter 3 es: "+cad.charAt(3)+"<BR>");
for(i=cad.length;i>=0;i--)
write(cad.charAt(i)+"<br>");
write("<br>");
write("Fuente FIXED: "+cad.fixed()+"<BR>");
write("De color: "+cad.fontcolor("#FF0000")+"<BR>");
write("De color: "+cad.fontcolor("salmon")+"<BR>");
write("Tamaño 7: "+cad.fontsize(7)+"<BR>");
write("<I>lo</I> esta en la posicion: "+cad.indexOf("lo")); <!--siempre da un valor
numerico y este sera menor que la longitud del caracter en este caso Hello World-->
PRINCIPAL
<html>
<head>
<LINK href="wea.css" rel="stylesheet" type="text/css">
<TITLE>Practico 2</title>
<script language="JavaScript">
function validarnumerico()
{
var key = window.event.keyCode;
return(key >= 48 && key <= 57);
}
function LIMP()
{
document.form1.text1.value="";
document.form1.text2.value="";
document.form1.text1.focus();
}
function calcular()
{
a=parseInt(document.form1.text1.value);
b=parseInt(document.form1.text2.value);
if (a!=0 && b!=0 && a > b)
{
dividir=window.open('dividir.html','4','left=100,top=100,width=250,height=300');
}
else if(a!=0 && b==0)
{
mostrar=window.open('mostrar.html','4','left=100,top=100,width=250,height=300');
}
else
{
otrocaso=window.open('otro
caso.html','4','left=100,top=100,width=250,height=300');
}
}
</script>
<style type="text/css">
<!--
.Estilo8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-weight: bold; font-size:
13px; }
.Estilo9 {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-weight: bold;
font-size: 12px;
color: #000000;
h1{color: green;border: solid red;}
}
-->
</style>
</head>
<body>
<form name="form1" method="post" action="">
<center><table summary="Tabla con css">
<caption>
<span class="Estilo9">VENTANA PRINCIPAL</span>
</caption>
<tr>
<th><div align="center" class="Estilo8">Ingresos</div></th>
<th><div align="center" class="Estilo8">Valor</div></th>
</tr>
<tr>
<td width="74%"><div align="right"><font size="2"><strong><font
face="Verdana, Arial, Helvetica, sans-serif">Primer
numero:</font></strong></font></div></td>
<td width="26%"><input name="text1" type="text" size="10" onkeypress="return
validarnumerico()"></td>
</tr>
<tr>
<td><div align="right"><font size="2"><strong><font face="Verdana, Arial,
Helvetica, sans-serif">Segundo
numero:</font></strong></font></div></td>
<td><input name="text2" type="text" size="10" onkeypress="return
validarnumerico()"></td>
</tr>
</table>
<table width="21%" border="1" align="center">
<tr>
<td><div align="center">
<input name="boton" type="button" onClick="calcular()" value="Ver">
</div></td>
<td><div align="center">
<input name="Reset" type="reset" value="Limpiar" onClick="LIMP()">
</div></td>
</tr>
</table></center>
<p> </p>
</form>
</body>
</html>
DIVIDIR
<html>
<head>
<TITLE>Dividir</title>
<script language="javaScript">
function inicio()
{
window.document.formdiv.text1.value = window.opener.form1.text1.value;
window.document.formdiv.text2.value = window.opener.form1.text2.value;
a=parseInt(document.formdiv.text1.value);
b=parseInt(document.formdiv.text2.value);
}
function dividir()
{
a=parseInt(document.formdiv.text1.value);
b=parseInt(document.formdiv.text2.value);
resultado=a/b;
document.formdiv.res.value=resultado;
}
</script>
</head>
<body onLoad="inicio()">
<div align="center"><strong><font face="Verdana, Arial, Helvetica, sans-
serif">VENTANA
DIVIDIR </font></strong> </div>
<form action="" method="get" name="formdiv">
<table width="17%" border="1" align="center">
<tr>
<td width="64%"><div align="right"><strong><font size="2" face="Verdana,
Arial, Helvetica, sans-serif">valor
1:</font></strong></div></td>
<td width="36%"><input name="text1" type="text" size="10"></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">valor
2:</font></strong></div></td>
<td><input name="text2" type="text" size="10"></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><input name="boton" type="button" value="Dividir"
onClick="dividir()"></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">resultado:</font></strong></div></td>
<td><input name="res" type="text" size="10"></td>
</tr>
</table>
</form>
</body>
</html>
OTRO
<html>
<head>
<TITLE>Sumar</title>
<script language="javaScript">
function inicio()
{
window.document.formsum.text1.value = window.opener.form1.text1.value;
window.document.formsum.text2.value = window.opener.form1.text2.value;
a=parseInt(document.formsum.text1.value);
b=parseInt(document.formsum.text2.value);
}
function sumar()
{
a=parseInt(document.formsum.text1.value);
b=parseInt(document.formsum.text2.value);
resultado=a+b;
document.formsum.res.value=resultado;
}
</script>
</head>
<body onLoad="inicio()">
<div align="center"><strong><font face="Verdana, Arial, Helvetica, sans-
serif">VENTANA
SUMAR</font></strong> </div>
<form action="" method="get" name="formsum">
<table width="17%" border="1" align="center">
<tr>
<td width="64%"><div align="right"><strong><font size="2" face="Verdana,
Arial, Helvetica, sans-serif">valor
1:</font></strong></div></td>
<td width="36%"><input name="text1" type="text" size="10"></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">valor
2:</font></strong></div></td>
<td><input name="text2" type="text" size="10"></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><input name="boton" type="button" value="Sumar" onClick="sumar()"></td>
</tr>
<tr>
<td><div align="right"><strong><font size="2" face="Verdana, Arial, Helvetica,
sans-serif">resultado:</font></strong></div></td>
<td><input name="res" type="text" size="10"></td>
</tr>
</table>
</form>
</body>
</html>
MOSTRAR.
<html>
<head>
<TITLE>Mostrar</title>
<script language="javaScript">
function inicio()
{
window.document.formmos.text1.value = window.opener.form1.text1.value;
a=parseInt(document.formmos.text1.value);
}
</script>
</head>
<body onLoad="inicio()">
<div align="center"><strong><font face="Verdana, Arial, Helvetica, sans-
serif">VENTANA
MOSTRAR</font></strong></div>
<form action="" method="get" name="formmos">
<table width="29%" border="1" align="center">
<tr>
<td width="80%"><div align="right"><strong><font size="2" face="Verdana,
Arial, Helvetica, sans-serif">El primer valor
es:</font></strong></div></td>
<td width="20%"><input name="text1" type="text" size="5"></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td><input name="boton" type="button" value="Volver"
onclick="window.close();"></td>
</tr>
</table>
</form>
</body>
</html>