29 nov 2017

Mi primer formulario HTML

Antes de que comenzamos

¿Qué son formularios HTML?

Los formularios HTML son uno de los puntos principales de interacción entre un usuario y un sitio web o aplicación. Ellos permiten a los usuarios enviar información a un sitio web. La mayor parte de las veces se envía información a un servidor web, pero la pagina web también puede interceptarla para usarla por su lado.

Un formulario HTML está hecho de uno o más widgets. Estos widgets puede ser campos de texto (de una linea o multilínea), cajas de selección, botones, checkboxes, o botones de radio. La mayoría del tiempo, estos widgets están junto a un label que describe su propósito.

¿Que necesitas para trabajar con formularios?

No necesitas nada mas que lo que se requiere para trabajar con HTML: un editor de texto y un web browser. Por supuesto, si estás acostumbrado a ello, puedes aprovechar un IDE completo como Visual Studio, Eclipse, Aptana, etc., pero eso depende de ti.

La diferencia principal entre un formulario HTML y HTML regular es que la mayoría del tiempo, la información recolectada por un formulario se envía a un servidor web. En ese caso, necesitas configurar un servidor web y procesar la información. Como configurar este tipo de servidor está mas allá de este artículo, pero si quieres saber más, visita el artículo dedicado a este tópico: Enviando y recuperando información de un formulario.

Diseñando tu formulario

Antes de comenzar a escribir código, es siempre mejor dar un paso atrás y tomarse el tiempo de pensar tu formulario. Diseñar un boceto en baja te ayudará a definir el correcto conjunto de informació que quieres preguntarle a tu usuario. Desde un punto de vista de experiencia del usuario, es importante recordar que mientras más grande tu formulario sea, mayor será el riesgo de perder usuarios. Mantenlo simple y mantén el foco: pregunta solamente lo que necesitas. Diseñar formularios es un paso importante cuando estes construyendo tu sitio o aplicación. Está más allá del alcance que este artículo cubre, pero si quieres introducirte en el tema deberías leer los siguientes artículos:

  • Smashing Magazine tiene muy buenos artículos sobre formularios y UX, pero tal vez el más importante sea su Guía Extensiva A Formularios Web y Usabilidad.
  • UXMatters es también un recurso muy reflexivo con buenos consejos desde mejoras prácticas básicas a temas complejos como formularios con  múltiples hojas.

En este artículo vamos a construir un formulario de contacto muy sencillo. Hagamos un esbozo.

The form to build, roughly sketch

Nuestro formulario va a contener tres campos de texto y un botón. Básicamente, preguntamos al usuario por su nombre, su correo electrónico y el mensaje que ellos quieran enviar. Cliqueando el botón enviará la información al servidor web.

Ensuciate las manos con HTML
Bien, ahora estamos listos para comenzar con HTML y codear nuestro formulario. Para construir nuestro formulario de contacto, vamos a utilizar los siguientes elementos de HTML: <form>, <label>, <input>, <textarea>, y <button>.

El elemento <form>

Todos los formularios HTML comienzan con el elemento <form> de la siguiente forma:

<form action="/my-handling-form-page" method="post">

</form>
Este elemento define formalmente un formulario. Es un contenedor como lo son <div> or <p>, pero también soporta algunos atributos específicos para configurar la forma en que el formulario se comporta. Todos sus atributos son opcionales pero se considera una buena práctica que siempre al menos el los atributos action y method se encuentren presentes.

  • El atributo action define la locación (una URL) desde donde la información recolectada por el formulario debería enviarse.
  • El atributo method define con que método HTTP se enviará la información (puede ser "get" o "post").
Agrega widgets con los elementos <label>, <input>, y <textarea> 

Nuestro formulario de contacto es muy simple y contiene tres campos de texto, cada uno con un label. El campo de texto para el nombre será de linea simple; el del e-mail también será de linea simple que aceptará solamente una dirección de correo electrónico; el campo de texto para el mensaje será multilínea.

En términos de código HTML vamos a tener algo como lo siguiente:

<form action="/my-handling-form-page" method="post">
    <div>
        <label for="name">Name:</label>
        <input type="text" id="name" />
    </div>
    <div>
        <label for="mail">E-mail:</label>
        <input type="email" id="mail" />
    </div>
    <div>
        <label for="msg">Message:</label>
        <textarea id="msg"></textarea>
    </div>
</form>
Los elementos <div> están allí para estructurar nuestro código de forma conveniente y poder darles estilos de una forma más sencilla (ver abajo). Puedes notar el uso de atributo for en todos los elementos <label>; es la forma correcta de unir un label a un widget en un formulario. Este atributo referencia el id del widget correspondiente. Hay algunos beneficios de hacer esto. El más obvio es permitir al usuario hacer click en el label para activar el widget correspondiente. Si quieres aprender otros beneficios, tienes todo detallado en el artículo: Como estructurar un formulario HTML.

En el elemento <input>, el atributo mas importante es type. Este atributo es sumamente importante porque define la forma en que el elemento <input> se comporta. Puede cambiar radicalmente el elemento, asi que presta atención a esto. Si quieres saber más sobre esto, lee el artículo Widgets nativos de formularios. En nuestro ejemplo usamos únicamente el valor text - el valor por defecto de este atributo. Representa un campo de texto básico de una linea que acepta cualquier tipo de texto sin ningún control o validación. 

Por último pero no menos importante, veamos la sintaxis del <input /> vs. <textarea></textarea>. Esta es una de las extrañezas del HTML. La etiqueta <input> se cierra a si misma, lo que significa que si quieres cerrar formalmente el elemento, tienes que agregar un " / " al final del mismo y no una etiqueta de cierre. Por el contrario, <textarea> no es un elemento que se cierre a si mismo, por lo que tienes que cerrarlo con su etiqueta correspondiente. Esto tiene impacto sobre una característica específica de los formularios HTML: la forma en que defines el valor por defecto. Para definir el valor por defecto de un elemento <input> debes usar el atributo value de la siguiente forma:

<input type="text" value="by default this element is filled with this text" />
Por el contrario, si quieres definir el valor por defecto de un <textarea>, solamente tienes que poner el valor por defecto entre el comienzo y el final de las etiquetas del elemento <textarea>, así:

<textarea>by default this element is filled with this text</textarea>
Y un <button> para finalizar

Nuestro formulario está casi listo; tenemos que agregar un botón para permitir al usuario enviar la información que llenó en el formulario. Esto se hace simplemente usando el elemento <button>:

<form action="/my-handling-form-page" method="post">
    <div>
        <label for="name">Name:</label>
        <input type="text" id="name" />
    </div>
    <div>
        <label for="mail">E-mail:</label>
        <input type="email" id="mail" />
    </div>
    <div>
        <label for="msg">Message:</label>
        <textarea id="msg"></textarea>
    </div>
    
    <div class="button">
        <button type="submit">Send your message</button>
    </div>
</form>
Un botón puede ser de tres tipos: submit, reset, o button.

Un click en un botón submit envía la información del formulario a una pagina web definida por defecto en el atributo action del elemento <form>.

Un click en un botón reset reinicia inmediatemente todos los widgets del formulario a sus valores por defecto. Desde un punto de viste de UX, esto se considera una mala práctica.

Un click en un botón button... ¡no hace nada! Puede sonar tonto, pero es muy útil para construir botones customizados con JavaScript.

Puedes también usar el elemento <input> con el type correspondiente para producir un botón. La diferencia principal con el elemento <button> es que el elemento <input> únicamente permite texto plano como su label mientras que el elemento <button> permite contenido HTML en su label

Hagamoslo un poco más lindo con CSS

Ahora que tenemos nuestro formulario HTML, si lo miras en tu navegador favorito, verás que se ve medio feo.


Vamos a hacer un poco más lindo con la siguiente hoja de CSS.

Vamos a empezar con el formulario en si mismo; vamos a centrarlo y hacerlo visible con un borde:

form {
    /* Sólo para centrar el formulario a la página */
    margin: 0 auto;
    width: 400px;
    /* Para ver el borde del formulario */
    padding: 1em;
    border: 1px solid #CCC;
    border-radius: 1em;
}
Luego, agreguemos algo de espacio entre cada uno de los widgets del formulario:

form div + div {
    margin-top: 1em; 
} 

Ahora nos enfoquemos en los labels. Para hacer nuestro formulario más legible, se considera una buena práctica tener todos los labels en el mismo tamaño y alineados del mismo lado. En este caso, vamos a alinearlos a la derecha, pero en algunos casos alinearlos a la izquierda está bien también.

label {
    /* Para asegurarse que todos los labels tienen el mismo tamaño y están alineados correctamente */
    display: inline-block;
    width: 90px;
    text-align: right;
}
Una de las cosas más dificiles de hacer con formularios HTML es estilizar los widgets HTML. Los campos de texto son fáciles de estilizar, pero otros widgets no. Si deseas saber más sobre estilizar widgets de formularios HTML, lee el artículo Estilizando formularios HTML.

Aquí vamos a usar un par de trucos comunes: armonizar fuentes, tamaños y bordes:

input, textarea {
    /* Para asegurarse de que todos los campos de texto tienen las mismas propiedades de fuente
       Por defecto, las areas de texto tienen una fuente con monospace */
    font: 1em sans-serif;

    /* Para darle el mismo tamaño a todos los campos de texto */
    width: 300px;
    -moz-box-sizing: border-box;
    box-sizing: border-box;

    /* Para armonizar el look&feel del borde en los campos de texto */
    border: 1px solid #999;
}
Los formularios HTML soportan muchas pseudo-clases para describir los estados de cada elemento. Como ejemplo, vamos a agregar un poco de destaque cuando un widget esté activo. Es una forma conveniente de ayudar al usuario a mantener el seguimiento de donde está en el formulario.

input:focus, textarea:focus {
    /* Para dar un pequeño destaque en elementos activos*/
    border-color: #000;
}
Campos de texto con múltiples lineas necesitan alugnos estilos personalizados para si mismos. Por defecto, un elemento <textarea> es inline block alineado al fondo en su base. La mayoría de las veces, esto no es lo que queremos. En este caso, para alinearlo de forma amigable el label y el campo, tenemos que cambiar la propiedad vertical-align a top del <textarea>.

Nota también el uso de la propiedad rezise, la cual es una forma conveniente para dejar a los usuarios cambiar el tamaño del <textarea>.

textarea {
    /* Para alinear campos de texto multilínea con sus labels */
    vertical-align: top;

    /* Para dar suficiente espacio para escribir texto */
    height: 5em;

    /* Para permitir a los usuarios cambiar el tamaño de cualquier textarea verticalmente
        No funciona en todos los navegadores */
    resize: vertical;
}
Muchas veces, los botones necesitan también estilos especiales. Para ese fin, los pusimos dentro de un <div> con la clase button. Aquí, queremos que el botón esté alineado con los otros widgets. Para lograr eso, tenemos que suponer un elemento <label>. Esto se logra jugando con el padding y el margin.

.button {
    /* Para posicionar los botones a la misma posición que los campos de texto */
    padding-left: 90px; /* mismo tamaño a todos los elementos label */
}
button {
    /* Este margen extra representa aproximadamente el mismo espacio que el espacio
       entre los labels y sus campos de texto */
    margin-left: .5em;
}
Ahora nuestro formulario se ve mucho mas lindo.


 Enviando información a tu servidor

La última parte, y tal vez la mas engañosa, es manejar la información del lado del servidor. Como dijimos, la mayor parte del tiempo, un formulario HTML es una forma conveniente de pedir al usuario la información para enviarla a un servidor web.

El elemento <form> va a definir donde y como enviar la información gracias a los atributos action y method.

Pero esto no es suficiente. También necesitamos dar un nombre a nuestra información. Esos nombres son importantes en ambos lados; del lado del navegador, le dice como nombrar cada parte de la información, y del lado del servidor, le permite manejar cada parte de la información por nombre.

Entonces para nombrar tu información necesitas usar el atributo name en cada widget del formulario que va a recolectar una parte específica de esa información: 

<form action="/my-handling-form-page" method="post">
    <div>
        <label for="name">Name:</label>
        <input type="text" id="name" name="user_name" />
    </div>
    <div>
        <label for="mail">E-mail:</label>
        <input type="email" id="mail" name="user_email" />
    </div>
    <div>
        <label for="msg">Message:</label>
        <textarea id="msg" name="user_message"></textarea>
    </div>
    
    <div class="button">
        <button type="submit">Send your message</button>
    </div>
</form>
En nuestro ejemplo, el formulario enviará 3 partes de información, llamadas "user_name", "user_email" y "user_message". La información se enviará a la URL "/my-handling-form-page" con el método POST de HTTP.

Del lado del servidor, el script en la URL "/my-handling-form-page" va a recibir la información como una lista de 3 items con clave/valor incorporados en la petición de HTTP. La forma en que este script va a manejar la información depende de ti. Cada lenguaje del lado del servidor (PHP, Python, Ruby, Java, C#, etc.).

17 nov 2017

Códigos de: Trucos y Efectos HTML | TODOS LOS QUE HAY

Ventajas y destajas de usarlos
Su ventaja general es el ampliar la interactividad del usuario, en otras palabras el transformar los simples documento (páginas) en prácticamente aplicaciones para ciertas cuestiones.

La desventaja primordial en su utilización es la gran posibilidad de perjudicar la usabilidad en cuanto a diseño y tiempo de carga.

1. Librate de los copiones. No dejar seleccionar el texto y bloquear  “Click Der” y “Ctrl”.
  1. <BODY oncontextmenu="return false" onselectstart="return false" ondragstart="return false"> </body>
2. Muestra al visitante un mensaje (alerta) al entrar a tu sitio web.
  1. <BODY onLoad="alert('Bienvenido a mi Página Web. Disfruta el contenido');" onUnLoad="confirm('Gracias por tu visita, espero que no sea la última');">
3. Pon en tu web un texto con Movimiento (Arriba-Abajo).
  1. <marquee id="ejemplo" direction="up"> AQUI VA EL TEXTO QUE DESEES </marquee><a href="javascript:void(0);" onclick="getElementById('ejemplo').direction='down';">Hacia abajo</a>---<a href="javascript:void(0);" onclick="getElementById('ejemplo').direction='up';">Hacia arriba</a>
4. Inserta el famoso botón de “Ir Arriba”. Imagen modificable (solo cambia la URL).
  1. </script></div><div class="n"><div class="n"> <a href="#" title="Ir arriba"><img alt="Ir arriba" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwDXnvl0hnRAun8ifUgsXMX8CCwq1Plc0qgjHQYYVhKwB2_SCwsL1OpRHT3qDfbYjLnpXHjdoKfOzeUro3RYn8XphzD3Map-JGX26TzlH7GhVkmDMnEfkeJh9MeMemEBTdxnUbi0bktI0/s200/arrow8a.png" style=position:fixed;bottom:0;right:0;/></a> </div>
5. Añade una atractiva Marquesina con el texto que quieras.
  1. <center> <div class="n"><p> <b><font color="#000000" face="georgia" size="4"><marquee width="400" scrollamount="5" bgcolor="#FFFFFF">Aquí tu texto</marquee> </font></b></p><center>
 6. Contenido oculto (ejemplo: código html) con botón “Mostrar”.
    1. <div class="pre-spoiler"> <span style="color: #00ffff;">Clic Para Mostrar El Contenido</span> <input type="button" value="Mostrar Contenido" style="width:80px;font-size:15px;margin:0px;padding:0px;" onclick= "if (this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display != '') { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = '';this.innerText = ''; this.value = 'Ocultar'; } else { this.parentNode.parentNode.getElementsByTagName('div')[1].getElementsByTagName('div')[0].style.display = 'none'; this.value = 'Mostrar';}" /> </div><div> <div class="spoiler" style="display: none;"> AQUI ESCRIBEN TODO EL CONTENIDO QUE OCULTARAN YA SEA UN CHAT, REPRODUCTOR,ETC </div></div>

     7. Titulo en la barra de direcciones con movimiento.

    1. <SCRIPT LANGUAGE="JavaScript">var txt=" TITULO DE LA WEB ";var espera=140;var refresco=null;function rotulo_title() {document.title=txt;txt=txt.substring(1,txt.length)+txt.charAt(0);refresco=setTimeout("rotulo_title()",espera);}rotulo_title();</script>

     8. Insertar un simple botón: “Imprimir Página Actual”.

    1. <h2><a href="javascript:print()"><span style="color: rgb(0, 255, 255);"><span style="font-family: Arial;"><span style="font-size: x-large;">Imprimir Contenido</span></span></span></a></h2>

     9. Añádele un increíble efecto eléctrico a tus enlaces.

    1. <style type="text/css"> a.navbar:hover{color:red; font-weight:bold;background-image:url(http://www.nackvision.com/myspace/links/lightningline.gif);} a:hover, a.redlink:hover, a.navbar:hover {background-image:url(http://www.nackvision.com/myspace/links/lightningline.gif); text-decoration:none; border:0px solid;} a:hover img {background-image:url(http://www.nackvision.com/myspace/links/lightningline.gif); filter:alpha(finishopacity=0, style=2); } </style>

     10. Texto (modificable) con un Efecto Parpadeante.

    1. <script language="JavaScript"> var estado=true; setTimeout("ver()",450); function ver (){ estado=!estado; if(estado==true) texto1.style.visibility="visible"; else texto1.style.visibility="hidden"; setTimeout("ver()",450); } </script><p align="center" id="texto1" style="visibility:visible"><font face="Arial, Helvetica, sans-serif size="3">AÑADE AQUI EL TEXTO QUE QUIERAS</font></p>

     11. Haz Que una Imagen se agrande al pasar el Cursor. Solo cambia la URL.

    1. <img src="AQUI VA LA URL DE LA IMAGEN" onmouseover="this.width=500;this.height=400;" onmouseout="this.width=200;this.height=150;" width="200" height="100" />

     12. Cambiar una imagen a otra al darle clic. Cambia las URLs.

    1. <script language="javascript">
    2. imagen1=new Image
    3. imagen1.src="url dela imagen 1"
    4. imagen2=new Image
    5. imagen2.src="url dela imagen 2"
    6. var i=1;
    7. function cambiar() {
    8. if (i == 1)
    9. {
    10. document.images['ejemplo'].src=imagen2.src
    11. i=2;
    12. }
    13. else
    14. {
    15. document.images['ejemplo'].src=imagen1.src;
    16. i=1;
    17. }
    18. }
    19. </script><img src="url dela imagen 1" name="ejemplo" onMousedown="cambiar()"">

    13. Inserta una caja como esta para poner códigos HTML.

    1. <div align="center"> <div id="preview" style= "BORDER-RIGHT: #000 1px solid; PADDING-RIGHT: 0px; BORDER-TOP: #000 1px solid; PADDING-LEFT: 2px; PADDING-BOTTOM: 2px; WORD-SPACING: 1px; OVERFLOW: scroll; BORDER-LEFT: #000 1px solid; WIDTH: 400px; PADDING-TOP: 1px; BORDER-BOTTOM: #000 2px solid; HEIGHT: 150px; TEXT-ALIGN: left"> <p> AQUI VA LO QUE TU QUIERAS, CAMBIA ESTE TEXTO. </p> </div></div>

    14. Traductor de Google para tu Página Web o Blog.

    1. <div><div id="google_translate_element"></div><script type="text/javascript">//<![CDATA[function googleTranslateElementInit() {new google.translate.TranslateElement({pageLanguage: 'es'}, 'google_translate_element');}//]]></script> <script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" type="text/javascript"></script></div>

    15. Botón social para compartir tu página web o blog en Taringa!.

    1. <script type="text/javascript">(function(){var x=document.createElement('script'), s=document.getElementsByTagName('script')[0];x.async=true;x.src='http://widgets.itaringa.net/share.js';s.parentNode.insertBefore(x,s)})()</script></div><div><t:sharer data-layout="big"></t:sharer>

    16. Muestra un Mensaje (Alerta) al Hacer clic en un enlace (Antes de ir).

    1. <a href="http://aqui va la dirección URL.com" onclick="javascript:alert('Aqui va el Mensaje');">Titulo del Vínculo</a>

    17. Aumenta el Tamaño del Texto de un Enlace al Pasar el Cursor.

    1. <div id="vinc"><a href="http://direcciondetusitio.com" onmouseover="javascript: void(document.getElementById('vinc').style.fontSize='3em')" onmouseout="javascript: void(document.getElementById('vinc').style.fontSize='1em')"> Vínculo</a></div>

     18. Pequeño widget que da en tiempo real el número de usuarios activos en tu web.

    1. <script id="_wauwaa">var _wau = _wau || []; _wau.push(["classic", "zltotgacrhd9", "waa"]);
    2. (function() {var s=document.createElement("script"); s.async=true;
    3. s.src="http://widgets.amung.us/classic.js";
    4. document.getElementsByTagName("head")[0].appendChild(s);
    5. })();</script>

     19. Botones Sociales de Twitter, Facebook, Google+ y Linkedin para Compartir.

    1. <script type="text/javascript" src="http://100widgets.com/js_data.php?id=255"></script>

     20. Inserta un Pequeño y Bonito Calendario en tu Página Web.

    1. <script type="text/javascript" src="http://100widgets.com/js_data.php?id=106"></script>

    Si es lo que buscabas, gracias por compartir.


    21. Inhabilitar el botón derecho con mensaje en pantalla completa.

    1. <script>
    2. // Inhabilitar el botón derecho
    3. var DADrccolor = "#F1F1F1";
    4. var DADrcimage = "https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSr_IdVVBZQP1yQ-5FVzVZTD9tZ5ex_Mu9vkp7foDNQ7OWg2hZS_xCe67xWJ-vguwloCaU30y6KJl5_yAod8H0TaFGHsTYNPMSpbQa15TXuzlOC1xKOspFva9XztscsVDH5TooTVjMusg/s300/superheroe.png";
    5. </script>
    6. <script type="text/javascript" src="http://yourjavascript.com/2122535051/antirightclick.js"></script>

     22. Efecto de sangre callendo desde la parte superior de tu web.

    1. <img border='0' src='http://u.jimdo.com/www21/o/s4e9df44a0ad8ccd8/img/i0425d9e289ed1713/1297446540/std/image.gif' style='position:fixed; top:0; left:0; width:100%; height:150px;'/>

    23. El Pajaro de Twiiter volando por toda tu página web o blog.

    1. <script src="https://sites.google.com/site/ayudabloggers/scripts/tripleflap.js" type="text/javascript"></script>
    2. <script type="text/javascript">
    3. var birdSprite='https://lh3.googleusercontent.com/-StM0Csn4ktc/TYNPdDXzNGI/AAAAAAAAAds/QPZ0-DbHgtc/s1600/birdsprite.png';
    4. var targetElems=new Array('img','hr','table','td','div','input','textarea','button','select','ul','ol','li','h1','h2','h3','h4','p','code','object','a','b','strong','span');
    5. var twitterAccount = 'http://twitter.com/USUARIO';
    6. var twitterThisText ='';
    7. tripleflapInit();
    8. </script>

     24. (Para Halloween) Una araña bajando desde la parte superior de tu sitio.

    1. <img border='0' src='https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWyL1gRaeS0udV_mqkNTRPMC59jotTwy0a83m7pL7Nnytam68sVY0f0FjEjW7_RWvr5g3HemMlXOkoq48JJAUk9_eRbjpEUGPkxFD3E38L9YCDxcFHzzK5VJktR4oWyRPXmuXJblQ7jvA/' style='position:fixed; top:0; left:0;'/>

     25. Efecto de corazones de color rojo cayendo (para San Valentin).

    1. <script language='javascript' type='text/javascript'>
    2. //<![CDATA[
    3. // Script original de Eloi Gallés Villaplana adaptado por -truco95.jimdo.com
    4. var numero = 8
    5. var velocidad = 40
    6. var imagenamor = " http://i1041.photobucket.com/albums/b416/conanaz72/GIF/heart.gif "
    7. var ns4arriba = (document.layers) ? 1 : 0
    8. var ie4arriba = (document.all) ? 1 : 0
    9. var dombrowser = (document.getElementById) ? 1 : 0
    10. var dx, xp, yp
    11. var am, stx, sty
    12. var i, doc_ancho = 1024, doc_alto = 768
    13. function amor() {
    14. establece_dimensiones()
    15. dx = new Array()
    16. xp = new Array()
    17. yp = new Array()
    18. am = new Array()
    19. stx = new Array()
    20. sty = new Array();
    21. for (i = 0; i < numero; ++ i) {
    22. dx[i] = 0
    23. xp[i] = Math.random()*(doc_ancho-50)
    24. yp[i] = Math.random()*doc_alto
    25. am[i] = Math.random()*20
    26. stx[i] = 0.02 + Math.random()/10
    27. sty[i] = 0.7 + Math.random()
    28. if (document.layers) {
    29. if (i == 0) {
    30. document.write("<layer name="dot"+ i +"" left="15" ")
    31. document.write("top="15" visibility="show"><img src="")
    32. document.write(imagenamor + "" border="0"></layer>")
    33. } else {
    34. document.write("<layer name="dot"+ i +"" left="15" ")
    35. document.write("top="15" visibility="show"><img src="")
    36. document.write(imagenamor + "" border="0"></layer>")
    37. }
    38. } else if (document.all
    39. || document.getElementById) {
    40. if (i == 0) {
    41. document.write("<div id="dot"+ i +"" style="POSITION: ")
    42. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ")
    43. document.write("visible; TOP: 15px; LEFT: 15px;"><img src="")
    44. document.write(imagenamor + "" border="0"></div>")
    45. } else {
    46. document.write("<div id="dot"+ i +"" style="POSITION: ")
    47. document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ")
    48. document.write("visible; TOP: 15px; LEFT: 15px;"><img src="")
    49. document.write(imagenamor + "" border="0"></div>")
    50. }
    51. }
    52. }
    53. corazon()
    54. }
    55. function corazon() {
    56. for (i = 0; i < numero; ++ i) {
    57. yp[i] += sty[i];
    58. if (yp[i] > doc_alto) {
    59. xp[i] = Math.random()*(doc_ancho-am[i]-30)
    60. yp[i] = 0
    61. stx[i] = 0.02 + Math.random()/10
    62. sty[i] = 0.7 + Math.random()
    63. establece_dimensiones()
    64. }
    65. dx[i] += stx[i];
    66. if ( document.all ) {
    67. var imagen = eval("dot" + i )
    68. imagen.style.posLeft = xp[i] + am[i]*Math.sin(dx[i])
    69. imagen.style.posTop = yp[i]
    70. }
    71. else if ( document.layers ) {
    72. var imagen = eval("document.dot" + i)
    73. imagen.left = xp[i] + am[i]*Math.sin(dx[i])
    74. imagen.top = yp[i]
    75. }
    76. else if ( document.getElementById ) {
    77. var imagen = document.getElementById( "dot" + i)
    78. imagen.style.left = xp[i] + am[i]*Math.sin(dx[i]) + 'px'
    79. imagen.style.top = yp[i] + 'px'
    80. }
    81. }
    82. setTimeout("corazon()", velocidad)
    83. }
    84. function establece_dimensiones() {
    85. if (self.innerHeight) {
    86. doc_ancho = self.innerWidth - 50
    87. doc_alto = self.innerHeight - 21
    88. } else if (document.documentElement &&
    89. document.documentElement.clientHeight) {
    90. doc_ancho = document.documentElement.clientWidth
    91. doc_alto = document.documentElement.clientHeight - 25
    92. } else if (document.body) {
    93. doc_ancho = document.body.clientWidth
    94. doc_alto = document.body.clientHeight - 25
    95. }
    96. }
    97. //]]>
    98. </script>
    99. <script language='javascript' type='text/javascript'>
    100. amor()
    101. </script>

     26. Pon una cuenta regresiva en tu página web. Busca en el código la fecha y cambiala junto con los textos.

    1. <center><span class="Apple-style-span" style="color: red; font-family: 'Trebuchet MS', sans-serif;">Faltan solamente</span></center><center><script language="JavaScript" type="text/javascript">
    2. //<![CDATA[
    3. TargetDate = "05/15/17 09:10 PM";
    4. BackColor = "white";
    5. ForeColor = "black";
    6. CountActive = true;
    7. CountStepper = -1;
    8. LeadingZero = true;
    9. DisplayFormat = "%%D%% Días, %%H%% Horas, %%M%% Minutos, %%S%% Segundos.";
    10. FinishMessage = "Feliz fin del mundo!!!";
    11. //]]>
    12. </script><script language="JavaScript" src="http://scripts.hashemian.com/js/countdown.js" type="text/javascript">
    13. </script></center><center><span class="Apple-style-span" style="color: red; font-family: 'Trebuchet MS', sans-serif;">Para el fin del mundo</span></center>

    27. Saludo al visitante dependiendo de la hora (ej: Buenas tardes).

    1. <center>
    2. <span style="font-size: large;"><span class="Apple-style-span" style="color: red;"><script language="JavaScript" type="text/javascript">
    3. //<![CDATA[
    4. <!--
    5. today = new Date()
    6. if(today.getMinutes() < 10){
    7. pad = "0"}
    8. else
    9. pad = "";
    10. document.write ;if((today.getHours() >=6) && (today.getHours() <=9)){
    11. document.write("¡Buen día!")
    12. }
    13. if((today.getHours() >=10) && (today.getHours() <=11)){
    14. document.write("¡Buen día!")
    15. }
    16. if((today.getHours() >=12) && (today.getHours() <=19)){
    17. document.write("¡Buenas tardes!")
    18. }
    19. if((today.getHours() >=20) && (today.getHours() <=23)){
    20. document.write("¡Buenas noches!")
    21. }
    22. if((today.getHours() >=0) && (today.getHours() <=3)){
    23. document.write("¡Buenas noches!")
    24. }
    25. if((today.getHours() >=4) && (today.getHours() <=5)){
    26. document.write("¡Buenas noches!")
    27. }
    28. // -->
    29. //]]>
    30. </script></span></span></center>

    28. Opciones en casilla que abren un enlace al seleccionarse. Sigue lo que se dice en el código para modificar los textos.

    1. <form>
    2. <ul>
    3. <li style="background-image:none;">
    4. <input value="ON" onclick="RubicusFrontendIns.location='URL del enlace 1'; return true;" type="checkbox" />Título del enlace 1
    5. </li>
    6. <li style="background-image:none;">
    7. <input value="ON" onclick="RubicusFrontendIns.location='URL del enlace 2'; return true;" type="checkbox" />Título del enlace 2
    8. </li>
    9. <li style="background-image:none;">
    10. <input value="ON" onclick="RubicusFrontendIns.location='URL del enlace 3'; return true;" type="checkbox" />Título del enlace 3
    11. </li>
    12. <li style="background-image:none;">
    13. <input value="ON" onclick="RubicusFrontendIns.location='URL del enlace 4'; return true;" type="checkbox" />Título del enlace 4
    14. </li>
    15. </ul>
    16. </form>

     29. Insertar un menu despegable con boton de continuidad. Para cambiar los textos tan solo sigue lo que hay en el código.

    1. <script language="JavaScript" type="text/javascript">
    2. //<![CDATA[
    3. function CC_go(form) {var myindex=form.dest.selectedIndex
    4. window.open(form.dest.options[myindex].value, target="_parent", "toolbar=yes,scrollbars=yes,location=yes"); }
    5. //]]>
    6. </script>
    7. <form name="CC_LinkForm" id="CC_LinkForm">
    8. <select name="dest" size="1">
    9. <option selected="selected" value="">
    10. Selecciona Algo
    11. </option>
    12. <option value=" enlace número uno">
    13. Titulo número 1
    14. </option>
    15. <option value="enlace número 2">
    16. Título número 2
    17. </option>
    18. <option value="enlace número 3">
    19. Titulo número 3
    20. </option>
    21. </select>
    22. <p>
    23. <input type="button" value="Ir ahí" onclick="CC_go(this.form)" />
    24. </p>
    25. </form>

     30. Colocar una imagen flotante (estatica) con opción para cerrar. Sustituye donde dice “URL de tu imagen aqui” por la dirección URL de la imagen a poner.

    1. <div id="anuncio" style="right:100px; bottom:0px; position: fixed;">
    2. <div align="right" style="margin-bottom:-30px;">
    3. <b><a href="javascript:closeit()"><font face="Courier" size="1">#CERRAR</font></a></b>
    4. </div>
    5. <br />
    6. <img border="0" src="URL de tu imagen aquí" alt="" /> <script type="text/javascript">
    7. //<![CDATA[
    8. function closeit(){
    9. document.getElementById("anuncio").style.visibility = "hidden";
    10. }
    11. //]]>
    12. </script>
    13. </div>
    14. <div class="clear">
    15. </div>

     31. Pequeño widget de Horoscopos.

    1. <p align="center"> <font color="#0C0505"><b><font class="navtext"><font face="Verdana" style="font-size:
    2. 9pt">HOROSCOPO</font><font class="content" size="1"><br /></font></font> <font class="navtext"><font face= "Verdana"
    3. size="1">Descubre Tu Destino Para</font><font class="navtext"><br /></font> <font face="Verdana" size="1"><font class="navtext">El Dia
    4. de Hoy</font><br /></font></font></b></font><b><font class="navtext" color="#0C0505"><font face="Verdana"
    5. color="#0C0505" size="1"><br /></font> <select style= "border-style:solid; border-width:1px; VISIBILITY: visible; font-family:Verdana; font-size:8pt;
    6. color:#0c0505; font-weight:bold; padding-left:5px; padding-right:6px; padding-top:1px; padding-bottom:1px; background-color:#ffffff" onchange=
    7. "if(this.options[1].selected)
    8. window.open('http://www.horoscopofree.com/misc/partnership/iframe/aries_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    9. else if(this.options[2].selected)
    10. window.open('http://www.horoscopofree.com/misc/partnership/iframe/taurus_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    11. else if(this.options[3].selected)
    12. window.open('http://www.horoscopofree.com/misc/partnership/iframe/gemini_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    13. else if(this.options[4].selected)
    14. window.open('http://www.horoscopofree.com/misc/partnership/iframe/cancer_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    15. else if(this.options[5].selected)
    16. window.open('http://www.horoscopofree.com/misc/partnership/iframe/leo_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    17. else if(this.options[6].selected)
    18. window.open('http://www.horoscopofree.com/misc/partnership/iframe/virgo_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    19. else if(this.options[7].selected)
    20. window.open('http://www.horoscopofree.com/misc/partnership/iframe/libra_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    21. else if(this.options[8].selected)
    22. window.open('http://www.horoscopofree.com/misc/partnership/iframe/scorpio_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    23. else if(this.options[9].selected)
    24. window.open('http://www.horoscopofree.com/misc/partnership/iframe/sagittarius_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    25. else if(this.options[10].selected)
    26. window.open('http://www.horoscopofree.com/misc/partnership/iframe/capricorn_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    27. else if(this.options[11].selected)
    28. window.open('http://www.horoscopofree.com/misc/partnership/iframe/aquarius_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');
    29. else if(this.options[12].selected)
    30. window.open('http://www.horoscopofree.com/misc/partnership/iframe/pisces_st.html','hrscp','width=460,height=100,top=150,left=175,scrolling=0,frameborder=0,status=0,menubar=0,scrollbars=0');"
    31. name="SucreVip" size="1"> <option selected="selected"> Elige tu signo
    32. </option> <option> Aries </option>
    33. <option> Tauro </option>
    34. <option> Geminis </option> <option>
    35. Cancer </option> <option>
    36. Leo </option> <option> Virgo
    37. </option> <option> Libra </option>
    38. <option> Escorpio </option>
    39. <option> Sagitario </option> <option>
    40. Capricornio </option> <option>
    41. Acuario </option> <option> Piscis
    42. </option> </select></font></b></p>
    43. <table> <tr> <td height="27" class="edit_rb_footer" id="edit_rb_footer_1">
    44. </td> </tr></table>;

     32. Un solo botón y varios enlaces. Fijate lo que hay que cambiar, es facil.

    1. <center><span style="font-family: Arial, Helvetica, sans-serif; font-size: x-small;"><script language="JavaScript" type="text/javascript">
    2. //<![CDATA[
    3. <!-- scrip presentado por truco95.jimdo.com -->
    4. var timerID = null
    5. var timerRunning = false
    6. var charNo = 0
    7. var charMax = 0
    8. var lineNo = 0
    9. var lineMax = 3
    10. var lineArr = new Array(lineMax)
    11. var urlArr = new Array(lineMax)
    12. lineArr[1] = "Texto número 1"
    13. urlArr[1] = "Enlace número 1"
    14. lineArr[2] = "Texto número 2"
    15. urlArr[2] = "Enlace número 2"
    16. lineArr[3] = "Texto número 3"
    17. urlArr[3] = "Enlace número 3"
    18. var lineText = lineArr[1]
    19. function StartShow() {
    20. StopShow()
    21. ShowLine()
    22. timerRunning = true
    23. }
    24. function FillSpaces() {
    25. for (var i = 1; i <= lineWidth; i++) {
    26. spaces += " "
    27. }
    28. }
    29. function StopShow() {
    30. if (timerRunning) {
    31. clearTimeout(timerID)
    32. timerRunning = false
    33. }
    34. }
    35. function ShowLine() {
    36. if (charNo == 0) {
    37. if (lineNo < lineMax) {
    38. lineNo++
    39. }
    40. else {
    41. lineNo = 1
    42. }
    43. lineText = lineArr[lineNo]
    44. charMax = lineText.length
    45. }
    46. if (charNo <= charMax) {
    47. document.formDisplay.buttonFace.value = lineText.substring(0, charNo)
    48. charNo++
    49. timerID = setTimeout("ShowLine()", 100)
    50. }
    51. else {
    52. charNo = 0
    53. timerID = setTimeout("ShowLine()", 3000)
    54. }
    55. }
    56. function GotoUrl(url)
    57. {
    58. RubicusFrontendIns.location.href = url
    59. }
    60. document.write("<form name="formDisplay">");
    61. document.write("<input type="button" name="buttonFace" value="&{lineText}" size="18" onClick="GotoUrl(urlArr[lineNo])">");
    62. document.write("</form>");
    63. StartShow();
    64. //]]>
    65. </script></span></center>

     33. Texto que cambia al actuaizarse la página. Edita los textos en el código.

    1. <script language="JavaScript" type="text/javascript">
    2. //<![CDATA[
    3. hoje = new Date()
    4. numero_de_textos = 4
    5. segundos = hoje.getSeconds()
    6. numero = segundos % numero_de_textos
    7. if (numero == 0){
    8. texto = "Texto número 1"
    9. }
    10. if (numero == 01){
    11. texto = "Texto número 2"
    12. }
    13. if (numero == 02){
    14. texto = "Texto número 3"
    15. }
    16. if (numero == 03){
    17. texto = "Texto número 4"
    18. }
    19. document.write('' + texto +'')
    20. //]]>
    21. </script>

     34. Widget para mostrar la fecha exacta en tu web.

    1. <p style="text-align: center;"> <iframe width="200" height="200" scrolling="no"
    2. src="http://pagina-del-dia.euroresidentes.es/gadget-dia-de-hoy.php?fondo=Rojo.png&amp;texto=FFFFFF" frameborder="0"></iframe></p>

     35. Crear un boton para abrir un enlace. Configuralo.

    1. <input type="button" value="Abrir" onclick="window.open('Aqui la direccion que quieres que se abra')" />

     36. Actualizar página con botón. Texto modificable.

    1. <form method="post">
    2. <input type="button" value="Actualizar Página" onclick="RubicusFrontendIns.location.reload()" />
    3. </form>

     37. Lista de enlaces en movimiento (marquesina) facil de entender para modificar.

    1. <marquee direction="up" onmouseout="this.start()" onmouseover="this.stop()" scrollamount="1" style="border: 2px solid #000; height: 200px; padding: 3px; text-align: center; width: 200px;">
    2. <a href="Enlace 1">Título 1</a><br />
    3. <a href="Enlace 2">Título 2</a><br />
    4. <a href="Enlace 3">Título 3</a>
    5. </marquee>

     38. Cerrar la ventana en la que se está con botón. Texto editable.

    1. <input type="button" value="Cerrar Ventana" onclick="window.close()" />

     39. Redireccionar a otra página con cuenta regresiva (3 s). Hay que configurar.

    1. <form name="redirect" id="redirect">
    2. <center>
    3. <font face="Arial">Serás redireccionado en<br />
    4. <br /></font>
    5. <form>
    6. <font face="Arial"><input type="text" size="3" name="redirect2" /></font>
    7. </form>
    8. <font face="Arial">segundos</font>
    9. </center>
    10. <script type="text/javascript">
    11. //<![CDATA[
    12. <!--
    13. var targetURL="http://truco95.jimdo.com/"
    14. var countdownfrom=5
    15. var currentsecond=document.redirect.redirect2.value=countdownfrom+1
    16. function countredirect(){
    17. if (currentsecond!=1){
    18. currentsecond-=1
    19. document.redirect.redirect2.value=currentsecond
    20. }
    21. else{
    22. RubicusFrontendIns.location=targetURL
    23. return
    24. }
    25. setTimeout("countredirect()",1000)
    26. }
    27. countredirect()
    28. //-->
    29. //]]>
    30. </script> <!--webbot bot="HTMLMarkup" endspan -->
    31. </form>

     40. Enmarcar un texto con borde configurable.

    1. <p style="border: ridge #FF0000 2px"> Aquí va lo que quieres enmarcar</p>

    41.  Poner enaces y un comentario al pasar el mouse en un cuadro de texto.

    1. <p>
    2. <script language="JavaScript"><!--
    3. function escribe(frase){document.desplaza.cuadro.value=frase; }
    4. // --></script>
    5. </p>
    6. <table border="0">
    7. <tr>
    8. <td width="200"><p align="center"><strong>Opciones.</strong></p>
    9. <p><a href="http://www.CheNico.com"
    10. onmouseover="escribe(' Página principaln ----------------nn Cuando hagas Click en este enlace irás directamente a la página de inicio de mi web');">Página
    11. principal</a><br>
    12. <a href="http://usuarios.lycos.es/pauluk/trucosprin.htm"
    13. onmouseover="escribe(' Trucos PCn -----------nn Este enlace te llevará a la página de Trucos PC en la que podés encontrar muchos más trucos interesantes para realizar e incluir en tus páginas web');">Trucos PC</a><br>
    14. <a href="http://usuarios.lycos.es/pauluk/GLOSARIO.HTM"
    15. onmouseover="escribe(' Glosarion -------------- nn Diccionario de Términos Informáticos. Enterate el significado de esas palabras de computación que decís todos los días pero que no sabés exactamente qué significa.');">Glosario</a><br>
    16. </p>
    17. </td>
    18. <td><form name="desplaza">
    19. <p><textarea name="cuadro" rows="8" cols="30"
    20. wrap="physical"></textarea></p>
    21. </form>
    22. </td>
    23. </tr>
    24. </table>

     42. Sbreponer un texto sobre otro.

    1. <P><CENTER><BR>
    2. <BR>
    3. <SPAN style="z-index: 1;
    4. font-family:Verdana
    5. font-weight: bold;
    6. font-size: 30pt;
    7. color: #FF9900">AQUI EL PRIMER TEXTO</SPAN><BR>
    8. <SPAN style="position: relative;
    9. top: -32px;
    10. left: 0px;
    11. z-index: 2;
    12. font-family: Verdana, Arial, Helvetica;
    13. font-size: 28pt;
    14. color: #006699">SEGUNDO TEXTO</SPAN><BR>
    15. <BR>
    16. <BR>
    17. <script>function src() { window.location = "view-source:" +
    18. window.location.href } </script></CENTER></P>

     43. Texto que aparece con increible efecto fade.

    1. <script language="JavaScript1.2">var delay=3000 //pausa (en milisegundos)
    2. var fcontent=new Array()
    3. begintag='<font face="Arial" size=2>' //tag que abre los mensajes
    4. fcontent[0]="<b></b><br><br>Crea tu propia pagina personal."
    5. fcontent[1]="Monta tu pagina con FrontPage Express , veras que es muy facil."
    6. fcontent[2]="En estas paginas encontraras los recursos y la manera de poder realizarlo de forma muy sencilla."
    7. closetag='</font>'
    8. var fwidth=150 //ancho
    9. var fheight=150 //alto
    10. ///No editar/////////////////
    11. var ie4=document.all&&!document.getElementById
    12. var ns4=document.layers
    13. var DOM2=document.getElementById
    14. var faderdelay=0
    15. var index=0
    16. if (DOM2)
    17. faderdelay=2000
    18. //function to change content
    19. function changecontent(){
    20. if (index>=fcontent.length)
    21. index=0
    22. if (DOM2){
    23. document.getElementById("fscroller").style.color="rgb(255,255,255)"
    24. document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag
    25. colorfade()
    26. }
    27. else if (ie4)
    28. document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag
    29. else if (ns4){
    30. document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag)
    31. document.fscrollerns.document.fscrollerns_sub.document.close()
    32. }
    33. index++
    34. setTimeout("changecontent()",delay+faderdelay)
    35. }
    36. // colorfade() partially by Marcio Galli for Netscape Communications. ////////////
    37. frame=20;
    38. hex=255 // Initial color value.
    39. function colorfade() {
    40. // 20 frames fading process
    41. if(frame>0) {
    42. hex-=10; // increase color value
    43. document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")";// Set color value.
    44. frame--;
    45. setTimeout("colorfade()",20);
    46. }
    47. else{
    48. document.getElementById("fscroller").style.color="rgb(255,0,0)";
    49. frame=20;
    50. hex=255
    51. }
    52. }
    53. if (ie4||DOM2)
    54. document.write('<div id="fscroller" style="border:1px solid ;width:'+fwidth+';height:'+fheight+';padding:2px"></div>')
    55. window.onload=changecontent</script><ilayer id="fscrollerns" width=&{fwidth}; height=&{fheight};><layer id="fscrollerns_sub" width=&{fwidth}; height=&{fheight}; left=0 top=0></layer></ilayer>

     44. Texto animado y cambiando en el titulo de la pestaña.

    1. <!-- Mas trucos en www.creatupropiaweb.com -->
    2. <SCRIPT LANGUAGE="JavaScript">
    3. var message = new Array();
    4. // Set your messages below -- follow the pattern.
    5. // To add more messages, just add more elements to the array.
    6. message[0] = "www.creatupropiaweb.com";
    7. message[1] = "Codigos JavaScripts";
    8. message[2] = "Trucos Diseño";
    9. message[3] = "Musica Midi";
    10. message[4] = "Juegos Flash";
    11. message[5] = "Tutoriales";
    12. message[6] = "... Todo y MUCHO mas GRATIS";
    13. // Set the number of repetitions (how many times the arrow
    14. // cycle repeats with each message).
    15. var reps = 2;
    16. var speed = 200; // Set the overall speed (larger number = slower action).
    17. // DO NOT EDIT BELOW THIS LINE.
    18. var p = message.length;
    19. var T = "";
    20. var C = 0;
    21. var mC = 0;
    22. var s = 0;
    23. var sT = null;
    24. if (reps < 1) reps = 1;
    25. function doTheThing() {
    26. T = message[mC];
    27. A();
    28. }
    29. function A() {
    30. s++;
    31. if (s > 8) { s = 1;}
    32. // you can fiddle with the patterns here...
    33. if (s == 1) { document.title = '||||||====||| '+T+' -----'; }
    34. if (s == 2) { document.title = '|||=|||===||| '+T+' -----'; }
    35. if (s == 3) { document.title = '|||==|||==||| '+T+' -----'; }
    36. if (s == 4) { document.title = '|||===|||=||| '+T+' -----'; }
    37. if (s == 5) { document.title = '|||====|||||| '+T+' -----'; }
    38. if (s == 6) { document.title = '|||===|||=||| '+T+' -----'; }
    39. if (s == 7) { document.title = '|||==|||==||| '+T+' -----'; }
    40. if (s == 8) { document.title = '|||=|||===||| '+T+' -----'; }
    41. if (C < (8 * reps)) {
    42. sT = setTimeout("A()", speed);
    43. C++;
    44. }
    45. else {
    46. C = 0;
    47. s = 0;
    48. mC++;
    49. if(mC > p - 1) mC = 0;
    50. sT = null;
    51. doTheThing();
    52. }
    53. }
    54. doTheThing();
    55. // End -->
    56. </script>

     45. La mejor marquesina que podras ver en tu vida. Cambia el texto.

    1. <script language="JavaScript">
    2. <!-- Mas javascripts en www.creatupropiaweb.com -->
    3. // This Script And Over 400 Others Found At
    4. // Java City 2000 http://www.jc2k.com
    5. <!-- ActiveASCII by Neal Kanodia (please, don't delete this line)
    6. // Get more JavaScript and other programs/scripts at my web page:
    7. // http://www.inlink.com/~hkanodia
    8. function createArr(num) { for(var i = 0; i < num; i++) { this[i] = null } }
    9. function fillArr(tx,me,ti,wa) { this.text = tx; this.method = me.toLowerCase(); this.ticks = ti; this.wait = wa }
    10. function block(num,txt,mthod,tcks,wit) { blocks[num] = new fillArr(txt,mthod,tcks,wit) }
    11. function ms(unt) { var sp = ""; for( var i = 1; i <= unt; i++ ) { sp += " " } return(sp) }
    12. function Activate() { if (cblock == max) { cblock = 0; if (iloop == 0) { loops--; if (loops == 0) { meth = "0" } else { meth = blocks[cblock].method } } else { meth = blocks[cblock].method } } else { meth = blocks[cblock].method }
    13. if (meth == "0") { document.Active.ASCII.value = end }
    14. if (meth == "display") { Tape = blocks[cblock].text; Wait = blocks[cblock].wait; Display() }
    15. if (meth == "display center") { Tape = blocks[cblock].text; Wait = blocks[cblock].wait; half = Tape.length / 2; DisplayC() }
    16. if (meth == "scroll left") { clen = tlen; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; tTicks = Ticks * 2; ScrollL() }
    17. if (meth == "scroll right") { clen = 0 - blocks[cblock].text.length; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; tTicks = Ticks * 2; ScrollR() }
    18. if (meth == "scroll lc") { clen = 0 - blocks[cblock].text.length; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; Wait = blocks[cblock].wait; tTicks = Ticks * 2; half = Tape.length / 2; ScrollLC() }
    19. if (meth == "scroll rc") { clen = tlen; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; Wait = blocks[cblock].wait; tTicks = Ticks * 2; half = Tape.length / 2; ScrollRC() }
    20. if (meth == "scroll cl") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; tTicks = Ticks * 2; half = Tape.length / 2; clen = cent - half; ScrollCL() }
    21. if (meth == "scroll cr") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; tTicks = Ticks * 2; half = Tape.length / 2; clen = cent - half; ScrollCR() }
    22. if (meth == "slide left") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; Wait = blocks[cblock].wait; cpos = 0; clet = Tape.charAt(cpos); clen = tlen; cstr = ""; SlideL() }
    23. if (meth == "slide lc") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; Wait = blocks[cblock].wait; cpos = Tape.length - 1; clet = Tape.charAt(cpos); clen = 0; cstr = ""; half = Tape.length / 2; iba = cent - half; ib = ms(iba); SlideLC() }
    24. if (meth == "slide rc") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; Wait = blocks[cblock].wait; cpos = 0; clet = Tape.charAt(cpos); cstr = ""; half = Tape.length / 2; clen = cent + half; fs = ms(cent - half); SlideRC() }
    25. if (meth == "slide cl") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; cpos = 0; clet = Tape.charAt(cpos); cstr = Tape.substring(1,Tape.length); half = Tape.length / 2; clen = cent - half; iba = 0; ib = ms(iba); SlideCL() }
    26. if (meth == "slide cr") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; cpos = Tape.length - 1; clet = Tape.charAt(cpos); cstr = Tape.substring(0,Tape.length - 1); half = Tape.length / 2; clen = 0; fs = ms(cent - half); SlideCR() }
    27. if (meth == "slip left") { clen = 0; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; SlipL() }
    28. if (meth == "slip right") { clen = 0; Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; SlipR() }
    29. if (meth == "slip letter") { Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; cpos = Tape.length - 1; clet = Tape.charAt(cpos); cstr = Tape.substring(0,Tape.length - 1); clen = 0; SlipLet() }
    30. if (meth == "split"){ Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; var iii = Tape.length / 2; if (iii / 2 != Math.ceil(iii / 2)) { Tape = Tape + " " } hstr1 = Tape.substring(0,Tape.length/2); hstr2 = Tape.substring(Tape.length/2,Tape.length); tTicks = Ticks * 2; clen = cent - hstr1.length; iba = 0; ib = ms(iba); Split() }
    31. if (meth == "merge"){ Tape = blocks[cblock].text; Ticks = blocks[cblock].ticks; var iii = Tape.length / 2; if (iii / 2 != Math.ceil(iii / 2)) { Tape = Tape + " " } hstr1 = Tape.substring(0,Tape.length/2); hstr2 = Tape.substring(Tape.length/2,Tape.length); tTicks = Ticks * 2; clen = 0 - hstr1.length; iba = tlen; ib = ms(iba); Wait = blocks[cblock].wait; Merge() } }
    32. function Display() { document.Active.ASCII.value = Tape; cblock++; timerID = setTimeout("Activate()",Wait) }
    33. function DisplayC() { var temp = cent - half; ini = ms(temp); document.Active.ASCII.value = ini + Tape; cblock++; timerID = setTimeout("Activate()",Wait) }
    34. function ScrollL() { if (clen >= 0) { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollL()",Ticks) } else { beg = 0 - clen; if (beg == Tape.length) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Ticks) } else { tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollL()",tTicks) } } }
    35. function ScrollR() { if (clen >= 0) { if (clen > tlen) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Ticks) } else { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollR()",Ticks) } } else { beg = 0 - clen; tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollR()",tTicks) } }
    36. function ScrollLC() { if (clen >= 0) { if (cent <= (clen + half)) { cblock++; timerID = setTimeout("Activate()",Wait) } else { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollLC()",Ticks) } } else { beg = 0 - clen; if (cent <= (clen + half)) { cblock++; timerID = setTimeout("Activate()",Wait) } else { tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollLC()",tTicks) } } }
    37. function ScrollRC() { if (clen >= 0) { if (cent >= (clen + half)) { cblock++; timerID = setTimeout("Activate()",Wait) } else { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollRC()",Ticks) } } else { beg = 0 - clen; if (cent >= (clen + half)) { cblock++; timerID = setTimeout("Activate()",Wait) } tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollRC()",tTicks) } }
    38. function ScrollCL() { if (clen >= 0) { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollCL()",Ticks) } else { beg = 0 - clen; if (beg >= Tape.length) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Wait) } else { tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("ScrollCL()",tTicks) } } }
    39. function ScrollCR() { if (clen >= 0) { if (clen > tlen) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Wait) } else { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollCR()",Ticks) } } else { beg = 0 - clen; tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("ScrollCR()",tTicks) } }
    40. function SlideL() { if (clen >= 0) { ini = ms(clen); tickered = cstr + ini + clet; document.Active.ASCII.value = tickered; clen -= 3; timerID = setTimeout("SlideL()",Ticks) } else { document.Active.ASCII.value = cstr + clet; cstr = document.Active.ASCII.value; clen = tlen - cstr.length; cpos++; clet = Tape.charAt(cpos); if (clet == " ") { cstr = cstr + " "; cpos++; clet = Tape.charAt(cpos) } if (clet == "") { cblock++; timerID = setTimeout("Activate()",Wait) } else { timerID = setTimeout("SlideL()",Ticks) } } }
    41. function SlideLC() { if (clen <= cent - half) { ini = ms(clen); tickered = ini + clet + ib + cstr; document.Active.ASCII.value = tickered; clen += 3; iba -= 3; ib = ms(iba); timerID = setTimeout("SlideLC()",Ticks) } else { iba = cent - half; ini = ms(iba); ib = ms(iba); document.Active.ASCII.value = ini + clet + cstr; cstr = clet + cstr; clen = 0; cpos--; if (cpos >= 0) { clet = Tape.charAt(cpos); if (clet == " ") { cstr = " " + cstr; cpos--; clet = Tape.charAt(cpos) } timerID = setTimeout("SlideLC()",Ticks) } else { cblock++; timerID = setTimeout("Activate()",Wait) } } }
    42. function SlideRC() { if (clen >= 0) { ini = ms(clen); tickered = fs + cstr + ini + clet; document.Active.ASCII.value = tickered; clen -= 3; timerID = setTimeout("SlideRC()",Ticks) } else { clen = cent + half; cstr += clet; document.Active.ASCII.value = fs + cstr; cpos++; clet = Tape.charAt(cpos); if (clet == " ") { cstr = cstr + " "; cpos++; clet = Tape.charAt(cpos) } if (clet == "") { document.Active.ASCII.value = fs + Tape; cblock++; timerID = setTimeout("Activate()",Wait) } else { timerID = setTimeout("SlideRC()",Ticks) } } }
    43. function SlideCL() { if (clen > 0) { ini = ms(clen); tickered = ini + clet + ib + cstr; document.Active.ASCII.value = tickered; clen -= 3; iba += 3; ib = ms(iba); timerID = setTimeout("SlideCL()",Ticks) } else { iba = 0; ib = ms(iba); clen = cent - half; ini = ms(clen); document.Active.ASCII.value = ini + cstr; cstr = cstr.substring(1,Tape.length); cpos++; clet = Tape.charAt(cpos); if (clet == " ") { cstr = cstr.substring(1,Tape.length); cpos++; clet = Tape.charAt(cpos) } if (clet == "") { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Ticks) } else { timerID = setTimeout("SlideCL()",Ticks) } } }
    44. function SlideCR() { if (clen <= cent + half) { ini = ms(clen); tickered = fs + cstr + ini + clet; document.Active.ASCII.value = tickered; clen += 3; timerID = setTimeout("SlideCR()",Ticks) } else { clen = 0; document.Active.ASCII.value = fs + cstr; cstr = cstr.substring(0,cstr.length - 1); cpos--; half += 1; if (cpos >= 0) { ; clet = Tape.charAt(cpos); if (clet == " ") { cstr = cstr.substring(0,cstr.length - 1); cpos--; clet = Tape.charAt(cpos) } timerID = setTimeout("SlideCR()",Ticks) } else { cblock++; timerID = setTimeout("Activate()",Ticks) } } }
    45. function SlipR() { if (clen >= 0) { if (clen > tlen) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Ticks) } else { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("SlipR()",Ticks) } } else { beg = 0 - clen; tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen++; timerID = setTimeout("SlipR()",Ticks) } }
    46. function SlipL() { if (clen >= 0) { ini = ms(clen); tickered = ini + Tape; document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("SlipL()",Ticks) } else { beg = 0 - clen; if (beg == Tape.length) { document.Active.ASCII.value = ""; cblock++; timerID = setTimeout("Activate()",Ticks) } else { tickered = Tape.substring(beg,tlen); document.Active.ASCII.value = tickered; clen--; timerID = setTimeout("SlipL()",Ticks) } } }
    47. function SlipLet() { if (clen < tlen) { ini = ms(clen); tickered = cstr + ini + clet; document.Active.ASCII.value = tickered; clen += 3; timerID = setTimeout("SlipLet()",Ticks) } else { clen = 0; cstr = cstr.substring(0,cstr.length - 1); cpos--; if (cpos >= 0) { ; clet = Tape.charAt(cpos); if (clet == " ") { cstr = cstr.substring(0,cstr.length - 1); cpos--; clet = Tape.charAt(cpos) } timerID = setTimeout("SlipLet()",Ticks) } else { cblock++; timerID = setTimeout("Activate()",Ticks) } } }
    48. function Split() { if (clen >= 0) { ini = ms(clen); tickered = ini + hstr1 + ib + hstr2; document.Active.ASCII.value = tickered; clen--; iba += 2; ib = ms(iba); timerID = setTimeout("Split()",Ticks) } else { if (clen <= 0 - hstr1.length) { cblock++; timerID = setTimeout("Activate()",Ticks) } else { beg = 0 - clen; tickered = hstr1.substring(beg,tlen); document.Active.ASCII.value = tickered + ib + hstr2; clen--; iba += 2; ib = ms(iba); timerID = setTimeout("Split()",tTicks) } } }
    49. function Merge() { if (clen >= 0) { if (clen > cent - hstr1.length) { tickered = ini + hstr1 + hstr2; document.Active.ASCII.value = tickered; cblock++; timerID = setTimeout("Activate()",Wait) } else { ini = ms(clen); tickered = ini + hstr1 + ib + hstr2; document.Active.ASCII.value = tickered; clen++; iba -= 2; ib = ms(iba); timerID = setTimeout("Merge()",Ticks) } } else { beg = 0 - clen; tickered = hstr1.substring(beg,tlen); document.Active.ASCII.value = tickered + ib + hstr2; clen++; iba -= 4; ib = ms(iba); timerID = setTimeout("Merge()",tTicks) } }
    50. /////////////////////////////////////////////////////////////////
    51. //# User Vars
    52. // Number of blocks (see bottom) to be displayed.
    53. // ***COMMON ERROR***: Make sure to set this value according to the
    54. // number of blocks (always the last block # + 1)!
    55. var max = 18
    56. // Don't change this!
    57. var blocks = new createArr(max)
    58. // Length of textbox
    59. // ***COMMON ERROR: If you change this or the length of the
    60. // textbox, remember to change the other accordingly.***
    61. var len = 50
    62. // Number of time to loop ALL blocks (use 0 for unlimited)
    63. var loops = 0
    64. // If you set the number of loops, set the final messege
    65. var end = 'End of "ActiveASCII" by Neal Kanodia.'
    66. // Use this format for each string (starting at 0 until 1 less
    67. // than max):
    68. // block(#block,"Text to display","Method",#ticks,#wait)
    69. // example: block(0,"1st block.","Scroll Left",25,0)
    70. // ***COMMON ERROR***: If you add a block INCREASE MAX BY 1
    71. // ***COMMON ERROR***: If you remove a block DECREASE MAX BY 1
    72. // ***COMMON ERROR***: Check the spelling of your methods!!!
    73. block(17,"Hola Bienvenidos a esta web","display",0,500)
    74. block(18,"Aqui pretendemos","display center",0,500)
    75. block(2,"Que aprendas a crearte","scroll left",25,0)
    76. block(3,"tu propia pagina","scroll right",25,0)
    77. block(4,"Con programas","scroll lc",25,500)
    78. block(5,"Tutoriales y contenidos","scroll rc",25,500)
    79. block(6,"javascripts como este","scroll cl",25,0)
    80. block(7,"Montones de servicios","scroll cr",25,0)
    81. block(8,"tantas y tantas cosas","slide left",25,500)
    82. block(9,"En fin, que ya no se que poner","slide lc",25,500)
    83. block(10,"De todas maneras","slide rc",25,500)
    84. block(11,"te recuerdo que si esto te ABURRE","slide cl",25,0)
    85. block(12,"TENEMOS UNA SUPER SECCION DE JUEGOS !","slide cr",25,0)
    86. block(13,"ademas de videos de humor","slip left",25,0)
    87. block(14,"animaciones flash","slip right",25,0)
    88. block(15,"aaa y foro tenemos foro","slip letter",25,0)
    89. block(16,"buuuf","display",0,500)
    90. block(0,"ya termino","merge",25,1000)
    91. block(1,"ya ESTA a DISFRUTARLO TODOS","split",25,0)
    92. //End User Vars
    93. /////////////////////////////////////////////////////////////////
    94. // Don't change!!!
    95. var tlen = 2.4 * len
    96. var cent = tlen / 2.2
    97. var clen = null
    98. var tickered = null
    99. var ini = null
    100. var iloop = 0
    101. if (loops == 0) {iloop = 1}
    102. var cblock = 0
    103. var timerID = null
    104. var beg = null
    105. var clet = null
    106. var cstr = null
    107. var cpos = null
    108. var ib = null
    109. var iba = null
    110. var fs = null
    111. var hstr1 = null
    112. var hstr2 = null
    113. <!-- end -->
    114. </script>
    115. <script language="JavaScript">
    116. document.write('<form name="Active" onSubmit="0">')
    117. document.write('<input type="text" name="ASCII" size="50">')
    118. document.write('</form>')
    119. Activate()
    120. </script>

     46. Pon un sonido o música de fondo. Solo coloca su URL.

    1. <BGSOUND SRC="sonido.mid" LOOP=none>
    2. <WIDTH=200 HEIGHT=55 AUTOSTART="true" LOOP="false" HIDDEN="true">

    ¿Como poner los códigos HTML en tu página web o blog?

    Para hacero he creado un articulo especial, lo puedes encontrar aqui, en el esta el tutorial para los sistemas de desarrollo web mas utilizados en el mundo de habla hispana.

    ¿Buscabas mas que trucos y efectos basicos?

    En en este sitio hay mucho mas que eso. Aquí se te muestra todo lo que puedes poner en tu web, sin importar con que programa este creada.
    Los códigos básicos (como los anteriores) están pasando de moda. Ve algunos widgets o plugins para tu página web increibles.
    A continuación algunos de los artículos con lo que posiblemente andes buscando.