Вы находитесь на странице: 1из 24

<td background="imagen.

jpg" width="XXX" height="XXX" />


Imagen de fondo en la tabla

http://www.uterra.com/internet/script/javascript_variados_02.htm Bloquea el botn derecho del ratn II. Bloquea el botn derecho del ratn sin mensaje de advertencia <html> <head> <title>Boton derecho que no actua sin mensaje de alerta</title> <script language="Javascript"> document.oncontextmenu = function(){return false} </script> </head> <body> El botn derecho del ratn no acta y no muestra ningn mensaje <p>www.uterra.com</p> </body> </html> Impide seleccionar el contenido. Impide seleccionar el contenido de una pagina ya sean imgenes o texto. Con ello evitas que te las puedan copiar. <html> <head> <title>Impide seleccionar el contenido de una pagina</title> <script language="Javascript"> function disableselect(e){ return false } function reEnable(){ return true } document.onselectstart=new Function ("return false") if (window.sidebar){ document.onmousedown=disableselect document.onclick=reEnable } </script> </head> <body> <p>Como puedes ver, esta linea de texto no puede ser seleccionada</p> <p>www.uterra.com</p> </body> </html> Bloqueo del teclado. Este script impide que el teclado pueda ser utilizado. Con ello puede evitar, por ejemplo, que se usen las teclas Control+C para copiar el contenido de tu pagina <html> <head> <title>Teclado bloqueado</title> <SCRIPT language=JavaScript> function shant() { alert('Esta pagina no te permite usar el teclado, lo siento') } document.onkeydown=shant; </SCRIPT> </head> <body> www.uterra.com

</body> </html> Una pgina dentro de otra. Este script permite mostrar el contenido de una pagina dentro de otra. <html> <head> <title>Ventana dentro de una pagina</title> </head> <body> <script language=JavaScript> var browser = navigator.appName; var version = navigator.appVersion; if (browser=="Microsoft Internet Explorer" && version>="4") { document.write('<iframe name="page" src="http://www.uterra.com" width="600" height="300" marginwidth="0" scrolling="yes" frameborder="0"></iframe>'); } </script> <p>www.uterra.com</p> </body> </html>

Redireccionamiento. Con este cdigo podrs enviar a los visitantes de una pagina a otra sin que ellos tengan que pulsar nada. <html> <head> <title>Pagina de redireccionamiento</title> <meta http-equiv="refresh" content="5;URL=http://www.uterra.com"> </head> <body> Esta es una pgina de redireccionamiento. </body> </html>

Evita que tu web se muestra en frames. Con este cdigo tu pagina escapar de los frames o marcos aprovechando as la totalidad de la pantalla, adems evitas que tu contenido pueda parecer que pertenece a otra pgina <html> <head> <title>Esta pgina no puede mostrase en frames</title> <script language="JavaScript"> if (top.location != self.location)top.location = self.location; //--> </script> </head> <body> Evita mostrarse en un frame </body> </html>

Multibuscador en tu web Este cdigo te permitir realizar bsquedas desde tu Web en los principales motores de bsqueda <!-- Elimina esta linea de texto al usar el codigo en tu web <html> <head> <title>Multibuscador uterra.com</title> <script> function url(x) { if (x==0) return "http://www.google.es/search?hl=es&q=" if (x==1) return "http://search.msn.es/results.aspx?cp=1252&PI=9539&DI=147&FORM=MSNH&q=" if (x==2) return "http://es.search.yahoo.com/search/es?p=" if (x==3) return "http://buscador.lycos.es/cgi-bin/pursuit?query=" if (x==4) return "http://www.excite.es/search/web/results?q=" if (x==5) return "http://buscador.terra.es/default.asp?ca=s&query=" if (x==6) return "http://es.altavista.com/web/results?itag=wrx&q=" if (x==7) return "http://www.sexyvista.com/sexo/sexo.html?palabras=" if (x==8) return "http://www.iberporno.com/cgi-bin/search.cgi?query=" if (x==9) return "http://www.seek69.com/cgi-bin/busqueda/search.cgi?query=" if (x==10) return "http://www.buscasexo.com.ar/cgi-bin/bsar/search.cgi?query=" return "" } function vaiURL(q,w) { window.location.href=url(q)+w return 0 } </script> </head> <body> <form method="GET" onSubmit="vaiURL(this.where.options.selectedIndex,this.what.value)"> <b><font face="Verdana" size="2">Buscar en Internet</font> <input size="40" name="what"> &nbsp;<font face="Verdana" size="2">a travs de</font> </b><select name="where"> <option value="http://www.google.es/search?hl=es&amp;q=" SELECTED>Google <option value="http://search.msn.es/results.aspx?cp=1252&amp;PI=9539&amp;DI=147&amp;FORM=MSNH&amp;q=">MSN <option value="http://es.search.yahoo.com/search/es?p=">Yahoo <option value="http://buscador.lycos.es/cgi-bin/pursuit?query=">Lycos <option value="http://www.excite.es/search/web/results?q=">Excite <option value="http://buscador.terra.es/default.asp?ca=s&amp;query=">Terra <option value="http://es.altavista.com/web/results?itag=wrx&amp;q=">Altavista <option value="http://www.sexyvista.com/sexo/sexo.html?palabras=">SEXY-Vista <option value="http://www.iberporno.com/cgi-bin/search.cgi?query=">IberPorno <option value="http://www.seek69.com/cgi-bin/busqueda/search.cgi?query=">Seek69 <option value="http://www.buscasexo.com.ar/cgi-bin/bsar/search.cgi?query=">BuscaSexo </select> <input type="button" value="Buscar" onClick="window.location.href=url(this.form.where.options.selectedIndex)+this.form.what.value" style="font-family: Verdana; font-weight: bold; color: #0000FF"> </form> &nbsp; <p align="center"> Por cortesa de <a href="http://www.uterra.com">www.uterra.com</a> </p> </body> </html> Elimina esta linea de texto al usar el codigo en tu web -->

Texto animado en la barra de titulo.

Con este cdigo puedes colocar un texto en la barra de titulo, que es esa franja que queda en el extremo superior del navegador donde tambin se encuentran los botones de cerrar, restaurar y minimizar <html> <head> <title>Texto animado en la barra de titulo</title> <SCRIPT LANGUAGE="JavaScript"> var txt=" --- Esto es un texto animado en la barra de titulo --- "; var espera=100; 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> </head> <body </body> </html>

Texto cambiante en la barra de titulo. Este cdigo te permite colocar varios mensaje en la barra de titulo, que es esa franja que queda en el extremo superior del navegador donde tambin se encuentran los botones de cerrar, restaurar y minimizar <html> <head>

<title>Texto animado cambiante en la barra de titulo</title> <SCRIPT LANGUAGE="JavaScript"> var message = new Array(); message[0] = "comentario"; message[1] = "aburrido"; message[2] = "o quizas"; message[3] = "interesante"; message[4] = "quien sabe?"; message[5] = "solo se que no se nada"; message[6] = "... JA JA JA JA "; // Set the number of repetitions (how many times the arrow // cycle repeats with each message). var reps = 2; var speed = 200; // Set the overall speed (larger number = slower action). var p = message.length; var T = ""; var C = 0; var mC = 0; var s = 0; var sT = null; if (reps < 1) reps = 1; function doTheThing() { T = message[mC]; A(); } function A() { s++; if (s > 8) { s = 1;} // you can fiddle with the patterns here... if (s == 1) { document.title = '||||||====||| '+T+' -----'; } if (s == 2) { document.title = '|||=|||===||| '+T+' -----'; } if (s == 3) { document.title = '|||==|||==||| '+T+' -----'; } if (s == 4) { document.title = '|||===|||=||| '+T+' -----'; } if (s == 5) { document.title = '|||====|||||| '+T+' -----'; } if (s == 6) { document.title = '|||===|||=||| '+T+' -----'; } if (s == 7) { document.title = '|||==|||==||| '+T+' -----'; } if (s == 8) { document.title = '|||=|||===||| '+T+' -----'; } if (C < (8 * reps)) { sT = setTimeout("A()", speed); C++; } else { C = 0; s = 0; mC++; if(mC > p - 1) mC = 0; sT = null; doTheThing(); } } doTheThing(); </script> </head> <body </body> </html> Texto que simula una ola. Con este script te aparece un texto que se mueve como una ola <html> <head> <title>Linea de texto que simula una ola</title> </head>

<body> <script language="JavaScript1.2"> //configuracion message="Muevete entre las olas con UTERRA.COM" ns6switch=1 var ns6=document.getElementById&&!document.all mes=new Array(); mes[0]=-1; mes[1]=-4; mes[2]=-7;mes[3]=-10; mes[4]=-7; mes[5]=-4; mes[6]=-1; num=0; num2=0; txt=""; function jump0(){ if (ns6&&!ns6switch){ jump.innerHTML=message return } if(message.length > 6){ for(i=0; i != message.length;i++){ txt=txt+"<span style='position:relative;' id='n"+i+"'>"+message.charAt(i)+"</span>"}; jump.innerHTML=txt; txt=""; jump1a() } else{ alert("El mensaje es muy corto") } } function jump1a(){ nfinal=(document.getElementById)? document.getElementById("n0") : document.all.n0 nfinal.style.left=-num2; if(num2 != 9){ num2=num2+3; setTimeout("jump1a()",50) } else{ jump1b() } } function jump1b(){ nfinal.style.left=-num2; if(num2 != 0){num2=num2-3; setTimeout("jump1b()",50) } else{ jump2() } } function jump2(){ txt=""; for(i=0;i != message.length;i++){ if(i+num > -10 && i+num < 7){ txt=txt+"<span style='position:relative;top:"+mes[i+num]+"'>"+message.charAt(i)+"</span>" } else{txt=txt+"<span>"+message.charAt(i)+"</span>"} } jump.innerHTML=txt; txt=""; if(num != (-message.length)){ num--; setTimeout("jump2()",50)}

else{num=0; setTimeout("jump0()",50)}} </script> <h2><div id="jumpx" style="color:red"></div> <script> if (document.all||document.getElementById){ jump=(document.getElementById)? document.getElementById("jumpx") : document.all.jumpx jump0() } else document.write(message) </script> </body> </html>

Texto animado. Con este cdigo puedes crear un bonito efecto animado ideal para banners muy atractivos <html> <head> <title>Texto animado</title> <style> .let{ color:white;

font-family:Verdana; font-weight:bold; width:500; filter:Shadow (Color="#FFFF00", Direction="135")wave(Add="0", Phase="4", Freq="9", LightStrength="20", Strength="1") ; } </style> <script language="JavaScript"> // Cambia o personaliza como ms te guste las siguientes opciones. var regel = 0; var size = 24; var delay = 1200; var speed = 25; var step = 10; // fila en donde comienza // tamao de la fuente // retardo entre los mensajes en MiliSegs. // velocidad de transicion del texto // tamao de cada paso

var sent = new Array() { sent[0] = "http://www.uterra.com"; sent[1] = "Cdigos JavaScript"; sent[2] = "Promocin Web"; sent[3] = "Promocin con BANNERS"; sent[4] = "te gusta lo que ves?"; sent[5] = "a que esperas? visitanosss"; } sent[sent.length] = sent[0];var veran = 0;var num = 0;var x = 0;//Don't change function moto(){output = "";for(letter = 0;letter<sent[regel+1].length;letter++){ if(veran == letter){if(x==0){num=num+step;}else{num=num-step;}gr = size-num; if(gr < 1){x=1;gr=1;}if(gr>size)gr=size; output += "<font style='font-size:"+gr +"pt'>"+sent[regel+x].substring(letter, letter+1)+"</font>"; if(num < 0 && x==1){veran++;x=0;}}else{if(veran > letter){ output += "<font style='font-size:"+size +"pt'>"+sent[regel+1].substring(letter, letter+1)+"</font>"; }else{output += "<font style='font-size:"+size +"pt'>"+sent[regel].substring(letter, letter+1)+"</font>";}}} return output;}function startmot(){if(regel==sent.length-1)regel=0;balk.innerHTML = moto(); if(veran==sent[regel+1].length){regel++;veran = 0;setTimeout("startmot()", delay);}else{ setTimeout("startmot()", speed);}} </script> </head> <body onload="startmot()"> <table style='cursor:hand' onclick=location="http://www.uterra.com" align="center" id="tafel" bgcolor="#000000" width=525 height="60"> <tr> <td bgcolor="#000000" bordercolor="#666666"> <div class='let' ID="balk" align="center"></div> </td> </tr> </table> </body> </html>

Hipervnculo a una URL y a un archivo. Aqu puedes ver la diferencia que hay entre un enlace a un archivo publicado en la red o a un archivo ubicado en tu equipo <html> <head> <title>Diferencia entre enlazar una URL y un archivo</title> </head> <body> ENLACE A URL <a href="http://www.uterra.com/crea_tu_web/principal.htm">enlace a url</a>

ENLACE A ARCHIVO <a href="file:///F:/crea_tu_web/principal.htm">enlace a archivo</a> </body> </html>

Hipervnculo con solo pasar el puntero. Con este cdigo puedes colocar un enlace de tal forma que no es necesario pulsar el ratn, basta con pasar el puntero sobre l, para dirigirnos al archivo de destino <html> <head> <title>Enlace con solo pasar el ratn</title> </head> <body> <a href="Doesn't matter" onMouseOver="parent.location='http://www.uterra.com'"> Enlace solo con pasar el ratn</a> </body> </html>

Informa sobre el destino del hipervnculo. Con este cdigo al colocar el puntero sobre el enlace te aparecer informacin sobre su destino <html> <head> <title>Informa sobre el destino de un enlace</title> <STYLE TYPE="text/css"> BODY {OVERFLOW:scroll;OVERFLOW-X:hidden} .DEK {POSITION:absolute; VISIBILITY:hidden; Z-INDEX:200;} </STYLE> </head> <body> <p ID="dek" CLASS="dek"> <SCRIPT TYPE="text/javascript"> Xoffset=-20; Yoffset= 20;

var nav,old,iex=(document.all),yyy=-1000; if(navigator.appName=="Netscape") {(document.layers)?nav= true: old=true;} if(!old){ var skn=(nav)?document.dek:dek.style; if(nav)document.captureEvents(Event.MOUSEMOVE); document.onmousemove=get_mouse; } function popup(msg){ var content="<TABLE WIDTH=130 BORDER=2 BORDERCOLOR=#FF9933 CELLPADDING=2 CELLSPACING=4 "+ "BGCOLOR=#CC33FF><TD ALIGN=center><FONT FACE=VERDANA SIZE=2 COLOR=#FFCC66><b>"+msg+"</b></FONT></TD></TABLE>"; if(old){alert(msg);return;} else{yyy=Yoffset; if(nav){skn.document.write(content); skn.document.close(); skn.visibility="visible"} if(iex){document.all("dek").innerHTML= content; skn.visibility="visible"} } } function get_mouse(e){ var x=(nav)?e.pageX:event.x+document.body.scrollLeft; skn.left= x+Xoffset; var y=(nav)?e.pageY:event.y+document.body.scrollTop; skn.top=y+yyy; } function kill(){ if(!old){yyy=-1000;skn.visibility="hidden";} } </SCRIPT> </p> <p><a href="http://www.uterra.com" onMouseOver="popup('El enlace te lleva a la pagina principal de UTERRA.COM')" onMouseOut="kill()" ;>ENLACE 1</a></p> <p><a href="http://www.uterra.com/crea_tu_web/principal.htm" onMouseOver="popup('Este enlace te lleva a la pagina principal del curso de diseo web de UTERRA.COM')" onMouseOut="kill()" ;>ENLACE 2</a> <p><a href="http://www.uterra.com/internet/codigos_javascript.htm" onMouseOver="popup('El enlace te lleva a la pagina de SCRIPT de UTERRA.COM')" onMouseOut="kill()" ;>ENLACE 3</a></p> </body> </html>

Enlace nuevo cada hora. Con este cdigo puedes mostrar una pgina nueva cada hora del da <html> <head> <title>Con este script se puede mostrar una pagina nueva cada hora</title> <script> var hora01=new Array() hora01[00]="http://www.uterra.com/internet/carpeta_web.htm" hora01[01]="http://www.uterra.com/internet/script/efectos_imagen_01.htm" hora01[02]="http://www.uterra.com/juegos/torre_hanoi.htm" hora01[03]="http://www.uterra.com/internet/script/hipervinculos_03.htm" hora01[04]="http://www.uterra.com/juegos/tetris.htm" hora01[05]="http://www.uterra.com/internet/tabla_colores.htm" hora01[06]="http://www.uterra.com/internet/juegos.htm" hora01[07]="http://www.uterra.com/internet/tu_pagina_web.htm" hora01[08]="http://www.uterra.com/internet/subdominio.htm" hora01[09]="http://www.uterra.com/internet/scrollbar.htm" hora01[10]="http://www.uterra.com/internet/script/efectos_texto_01.htm"

hora01[11]="http://www.uterra.com/internet/script/hipervinculos_04.htm" hora01[12]="http://www.uterra.com/internet/promocion_web.htm" hora01[13]="http://www.uterra.com/internet/herramientas_web.htm" hora01[14]="http://www.uterra.com/internet/script/fundamentales_01.htm" hora01[15]="http://www.uterra.com/internet/etiquetas_metatag.htm" hora01[16]="http://www.uterra.com/internet/dominio.htm" hora01[17]="http://www.uterra.com/internet/alojamiento_web.htm" hora01[18]="http://www.uterra.com/internet/crear_web.htm" hora01[19]="http://www.uterra.com/internet/codigos_javascript.htm" hora01[20]="http://www.uterra.com/internet/codifica_email.htm" hora01[21]="http://www.uterra.com/internet/script/efectos_imagen_02.htm" hora01[22]="http://www.uterra.com/internet/carpeta_web.htm" hora01[23]="http://www.uterra.com/internet/script/fundamentales_02.htm" var myDate=new Date() var foto_hora=myDate.getHours() </script> </head> <body> <center> <a href="uterra" onClick="window.location=hora01[foto_hora];return false"> <font face="Verdana" size="2"><b>ENLACE CADA HORA</b></font></a> </center> <center> <a href="uterra" onClick="window.location=hora01[foto_hora];return false"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0012.jpg" width="125" height="125"></a> </center> <center> <input TYPE="button" VALUE="ENLACE CADA HORA" onClick="window.location=hora01[foto_hora];return false"> </center> </body> </html>

Efecto de burbujas. Con este script podrs crear un atractivo efecto de burbujas con imgenes para tu Web Burbujas hacia arriba <html> <head> <TITLE>Llamativo efecto de burbujas</TITLE> </head> <body> <p align="center"> <script language="JavaScript1.2"> var no = 15; // numero de imagenes que se desplazan var speed = 30; // velocidad del desplazamiento var snow = new Array(); snow[0] = "http://www.uterra.com/images_uterra/demos_script/demo_script0004.jpg" snow[1] = "http://www.uterra.com/images_uterra/demos_script/demo_script0005.jpg" snow[2] = "http://www.uterra.com/images_uterra/demos_script/demo_script0006.jpg" var ns4up = (document.layers) ? 1 : 0; // browser sniffer

var ie4up = (document.all) ? 1 : 0; var ns6up = (document.getElementById&&!document.all) ? 1 : 0; var dx, xp, yp; // coordinate and position variables var am, stx, sty; // amplitude and step variables var i, doc_width = 800, doc_height = 1800; if (ns4up||ns6up) { doc_width = self.innerWidth; doc_height = self.innerHeight; } else if (ie4up) { doc_width = document.body.clientWidth; doc_height = document.body.clientHeight; } dx = new Array(); xp = new Array(); yp = new Array(); am = new Array(); stx = new Array(); sty = new Array(); j = 0; for (i = 0; i < no; ++ i) { dx[i] = 0; // set coordinate variables xp[i] = Math.random()*(doc_width-50); // set position variables yp[i] = Math.random()*doc_height; am[i] = Math.random()*20; // set amplitude variables stx[i] = 0.02 + Math.random()/10; // set step variables sty[i] = 0.7 + Math.random(); // set step variables if (ns4up) { // set layers if (i == 0) { document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>"); } else { document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\""+ snow[j] + "\" border=\"0\"></layer>"); } } else if (ie4up||ns6up) { if (i == 0) { document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>"); } else { document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"VISIBILITY: visible; TOP: 15px; LEFT: 15px; width:1;\"><img src=\"" + snow[j] + "\" border=\"0\"></div>"); } } if (j == (snow.length-1)) { j = 0; } else { j += 1; } } function snowNS() { // Netscape main animation function for (i = 0; i < no; ++ i) { // iterate for every dot yp[i] -= sty[i]; if (yp[i] < -50) { xp[i] = Math.random()*(doc_width-am[i]-30); yp[i] = doc_height; stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); doc_width = self.innerWidth; doc_height = self.innerHeight; } dx[i] += stx[i]; document.layers["dot"+i].top = yp[i]; document.layers["dot"+i].left = xp[i] + am[i]*Math.sin(dx[i]); } setTimeout("snowNS()", speed); } function snowIE_NS6() { // IE main animation function for (i = 0; i < no; ++ i) { // iterate for every dot yp[i] -= sty[i]; if (yp[i] < -50) { xp[i] = Math.random()*(doc_width-am[i]-30); yp[i] = doc_height;

stx[i] = 0.02 + Math.random()/10; sty[i] = 0.7 + Math.random(); doc_width = ns6up?window.innerWidth-5:document.body.clientWidth; doc_height = ns6up?window.innerHeight-5:document.body.clientHeight; } dx[i] += stx[i]; if (ie4up){ document.all["dot"+i].style.pixelTop = yp[i]; document.all["dot"+i].style.pixelLeft = xp[i] + am[i]*Math.sin(dx[i]); } else if (ns6up){ document.getElementById("dot"+i).style.top=yp[i]; document.getElementById("dot"+i).style.left=xp[i] + am[i]*Math.sin(dx[i]); } } setTimeout("snowIE_NS6()", speed); } if (ns4up) { snowNS(); } else if (ie4up||ns6up) { snowIE_NS6(); } </script> <a href="http://www.uterra.com">www.uterra.com</a> </body> </html>

Mensaje de despedida. Cuando el visitante abandona tu pagina salta un mensaje de despedida, una buena forma de ser siempre cortes <html> <head> <title>Mensaje de despedida al cerrar pagina</title> <SCRIPT language="JavaScript"> function goAway() { alert('Hasta pronto! Y no te olvides de W W W . U T E R R A . C O M'); } </SCRIPT> </head> <body bgcolor="white" onUnload="goAway()"> </body> </html> Un saludo cada da. Saluda a tus visitantes de manera distinta segn el da de la semana

<HTML> <HEAD> <TITLE>Un mensaje nuevo cada dia de la semana</TITLE> </HEAD> <BODY> <SCRIPT LANGUAGE="JavaScript"> document.write("<center><font size=+1><b>") now = new Date() if (now.getDay() == 0) document.write("Es domingo, y la semana pasada tras el domingo venia el lunes, ser otra vez igual?") if (now.getDay() == 1) document.write("Es lunes. Es horrible") if (now.getDay() == 2) document.write("Es martes, el que queda antes del miercoles.") if (now.getDay() == 3) document.write("Es mircoles, y maana otra vez jueves.") if (now.getDay() == 4) document.write("Es jueves, ya queda menos, paciencia") document.write("</b></center></font>") if (now.getDay() == 5) document.write("Siempre despues del jueves dicen que viene el viernes, que guay!") if (now.getDay() == 6) document.write("Es sbado, y todo por que ayer fue viernes, esto es super-guay") </SCRIPT> </body> </html>

Secuencia de mensajes. Este cdigo es ideal para hacer una presentacin rpida de los contenidos de tu pgina web <html> <head> <body> <script language="JavaScript1.2"> var delay=2500 //pausa (en milisegundos) var fcontent=new Array() begintag='<font face="Verdana" size=2>' //tag que abre los mensajes fcontent[0]="<b>Ejemplo...</b><br><br>Este script es muy practico para hacer una rapida presentacin de tu sitio web." fcontent[1]="Un sitio Web bien presentado puede conseguir visitas mas adaptada a tus contenidos." fcontent[2]="La continua actualizacion de un sitio web es uno de los mejores incentivos para el visitante." closetag='</font>' var fwidth=150 //ancho var fheight=150 //alto ///No editar///////////////// var ie4=document.all&&!document.getElementById var ns4=document.layers var DOM2=document.getElementById var faderdelay=0

var index=0 if (DOM2) faderdelay=2000 //function to change content function changecontent(){ if (index>=fcontent.length) index=0 if (DOM2){ document.getElementById("fscroller").style.color="rgb(255,255,255)" document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag colorfade() } else if (ie4) document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag else if (ns4){ document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag) document.fscrollerns.document.fscrollerns_sub.document.close() } index++ setTimeout("changecontent()",delay+faderdelay) } frame=20; hex=255 // Initial color value. function colorfade() { // 20 frames fading process if(frame>0) { hex-=12; // increase color value document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value. frame--; setTimeout("colorfade()",20); } else{ document.getElementById("fscroller").style.color="rgb(0,0,0)"; frame=20; hex=255 } } if (ie4||DOM2) document.write('<div id="fscroller" style="border:1px solid black;width:'+fwidth+';height:'+fheight+';padding:2px"></div>') 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> </body> </html>

reloj digital AM - PM. Otro reloj con uso horario de 12 horas <html> <head> <title>Reloj de ciclo de 12 horas con horas, minutos y segundos</title> </head> <body onLoad="show5()"> <span id="liveclock" style="position:absolute;left:0;top:0;"> </span> <script language="JavaScript">

function show5(){ if (!document.layers&&!document.all&&!document.getElementById) return var Digital=new Date() var hours=Digital.getHours() var minutes=Digital.getMinutes() var seconds=Digital.getSeconds() var dn="AM" if (hours>12){ dn="PM" hours=hours-12 } if (hours==0) hours=12 if (minutes<=9) minutes="0"+minutes if (seconds<=9) seconds="0"+seconds //change font size here to your desire myclock="<font size='2' face='Arial' ><b><font size='1'>www.uterra.com</font></br>"+hours+":"+minutes+":" +seconds+" "+dn+"</b></font>" if (document.layers){ document.layers.liveclock.document.write(myclock) document.layers.liveclock.document.close() } else if (document.all) liveclock.innerHTML=myclock else if (document.getElementById) document.getElementById("liveclock").innerHTML=myclock setTimeout("show5()",1000) } </script> </body> </html>

Abrir una ventana secundaria. Aqu te mostramos el cdigo para abrir una ventana secundaria con todos sus posibles parmetros de configuracin <html> <head> <title>Ventana secundaria con todos los parmetros para su configuracin</title> <script language=javascript> function Ventana_001 (URL){ window.open(URL,"UTERRA","width=500,height=300,top=20,left=40,scrollbars=NO,titlebar=NO,menubar=YES,toolbar=NO,directo ries=YES,location=YES,status=NO,resizable=NO") } </script> </head> <body> <p><a href="javascript:Ventana_001('http://www.uterra.com')"> <font face="Verdana" color="#FF0000">Enlace</font></a></p> <p><input type=button value="Enlace" onclick="Ventana_001('http://www.uterra.com')"></p> <p><a href="javascript:Ventana_001('http://www.uterra.com')"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0008.jpg" width="125" height="125"></a></p> </body> </html>

Abrir varias ventanas secundarias. Con este cdigo puedes abrir tantas ventanas secundarias distintas como desees, ha sido creado para tres, aade las que quieras <html> <head> <title>Abre tres ventanas secundarias distintas con tres tipos de enlace</title> <script language=javascript> function Ventana_001 (URL){ window.open(URL,"UTERRA","width=500,height=300,top=300,left=40,scrollbars=NO,titlebar=NO,menubar=YES,toolbar=NO,direct ories=YES,location=YES,status=NO,resizable=NO") } </script> <script language=javascript> function Ventana_002 (URL){ window.open(URL,"UTERRA","width=300,height=400,top=50,left=100,scrollbars=NO,titlebar=NO,menubar=NO,toolbar=NO,direct ories=YES,location=NO,status=NO,resizable=NO") } </script> <script language=javascript> function Ventana_003 (URL){ window.open(URL,"UTERRA","width=300,height=300,top=100,left=450,scrollbars=YES,titlebar=NO,menubar=YES,toolbar=NO,dire ctories=YES,location=YES,status=NO,resizable=YES") } </script> </head> <body> <p><a href="javascript:Ventana_001('http://www.uterra.com')"> <font face="Verdana" color="#FF0000">Enlace</font></a></p> <p><a href="javascript:Ventana_002('http://www.uterra.com/internet/codigos_javascript.htm')"> <font face="Verdana" color="#FF0000">Enlace</font></a></p> <p><a href="javascript:Ventana_003('http://www.uterra.com/internet/promociona_web.htm')"> <font face="Verdana" color="#FF0000">Enlace</font></a></p> <p>------------------------------------------------------------------</p> <p><input type=button value="ENLACE" onclick="Ventana_001('http://www.uterra.com')"></p> <p><input type=button value="ENLACE" onclick="Ventana_002('http://www.uterra.com/internet/crear_web.htm')"></p> <p><input type=button value="ENLACE" onclick="Ventana_003('http://www.uterra.com/internet/promociona_web.htm')"></p> <p>------------------------------------------------------------------</p> <p><a href="javascript:Ventana_001('http://www.uterra.com')"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0008.jpg" width="125" height="125"></a></p> <p><a href="javascript:Ventana_002('http://www.uterra.com/internet/crear_web.htm')"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0007.jpg" width="125" height="125"></a></p> <p><a href="javascript:Ventana_003('http://www.uterra.com/internet/promociona_web.htm')"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0006.jpg" width="125" height="125"></a></p> </body> </html>

Abre tu pagina en la totalidad de la pantalla. Este script abre tu pagina en la totalidad de la pantalla, para cerrar esta ventana pulsa ALT + F4. <html> <head> <title>Abre una ventana que ocupa por completo la pantalla</title> <script language=javascript> function PantallaCompleta (URL){ window.open("http://www.uterra.com","","fullscreen,scrollbars") } </script> </head> <body> <p><a href="javascript:PantallaCompleta('http://www.uterra.com')"><font face="Verdana" color="#FF0000">Pantalla Completa</font></a></p> <p><input type=button value="Pantalla Completa" onclick="PantallaCompleta('http://www.uterra.com')"></p> <p><a href="javascript:PantallaCompleta('http://www.uterra.com')"> <img border="0" src="http://www.uterra.com/images_uterra/demos_script/demo_script0001.jpg" width="125" height="125"></a></p> </body> </html>

Men desplegable I. Este cdigo permite crear un men desplegable en forma de campo de eleccin mltiple <html> <head> <title>Navegador desplegable</title> <script language=javascript> function destino(){ url = document.navegador.secciones.options[document.navegador.secciones.selectedIndex].value if (url != "no") window.location = url; } </script> </head> <body> <form name=navegador> <select name="secciones" onchange="destino()" style="font-family: Verdana; font-size: 8 pt; color: #000080; font-weight: bold" size="1"> <option value="no">Enlaces de UTERRA.COM <option value="no">-------------------------------------<option value="http://www.uterra.com/">Portada <option value="http://www.uterra.com/crea_tu_web/principal.htm">Curso web <option value="http://www.uterra.com/internet/crear_web.htm">Crea tu web <option value="http://www.uterra.com/programas">Programas de diseo Web <option value="http://www.uterra.com/internet/dominio.htm">Dominios <option value="http://www.uterra.com/internet/codigos_javascript.htm">Codigos JavaScript <option value="http://www.uterra.com/internet/juegos.htm">Juegos

<option value="no">-------------------------------------<option value="http://www.uterra.com/internet/promocion_web.htm">Promocin Web <option value="http://www.uterra.com/internet/etiquetas_metatag.htm">Generador MetaTag </select> </form> </body> </html>

Men desplegable II. Similar al anterior, este javascript permite abrir la pagina un una pagina nueva. El enlace se establece al pulsar un botn <html> <head> <title>Men desplagable con opcion de apertura en una ventana nueva</title> <script language="javascript"> function gothere(){ var thebox=document.mycombowopt if (thebox.windowoption.checked){ if (!window.newwindow) newwindow=window.open("") newwindow.location= thebox.example.options[thebox.example.selectedIndex].value } else location= thebox.example.options[thebox.example.selectedIndex].value } </script> </head> <body> <form name="mycombowopt"> <select name="example" size=1> <option value="http://www.uterra.com">UTERRA</option> <option value="http://www.uterra.com/internet/etiquetas_metatag.htm">MetaTag</option> <option value="http://www.uterra.com/internet/codifica_email.htm">Codifica e-mail</option> <option value="http://www.uterra.com/internet/subdominio.htm">Subdominios</option> </select> <input type="button" value="Visitar" onClick="gothere()"> <br> <input type="checkbox" name="windowoption" value="ON"><font face="Verdana" size="2">Abrir en una ventana nueva</font> </form> </body> </html>

MENSAJE DE ESPERA MIENTRAS CARGA LA PAGINA <BODY onLoad="cacheOff()"> <STYLE TYPE="text/css"> #cache { position:absolute; left=10; top:10px; z-index:10; visibility:hidden; } </STYLE> <SCRIPT LANGUAGE="JavaScript"> ver = navigator.appVersion.substring(0,1) if (ver >= 4) { document.write('<DIV ID="cache"><TABLE WIDTH=400 BGCOLOR=#000000 BORDER=0 CELLPADDING=2 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><TABLE WIDTH=100% BGCOLOR=#FFFFFF BORDER=0 CELLPADDING=0 CELLSPACING=0><TR><TD ALIGN=center VALIGN=middle><FONT FACE="Arial, Verdana" SIZE=4><B><BR>ESPERE POR FAVOR ... <BR><BR></B></FONT></TD> </TR></TABLE></TD> </TR></TABLE></DIV>'); var navi = (navigator.appName == "Netscape" && parseInt(navigator.appVersion) >= 4); var HIDDEN = (navi) ? 'hide' : 'hidden'; var VISIBLE = (navi) ? 'show' : 'visible'; var cache = (navi) ? document.cache : document.all.cache.style; largeur = screen.width; cache.left = Math.round(100); cache.visibility = VISIBLE; } function cacheOff() { if (ver >= 4) { cache.visibility = HIDDEN; } } </SCRIPT>

Deteccion de Flash . Detectando si un visitante tiene o no el plug-in de Macromedia Flash Instalado en su sistema.
<head> <SCRIPT LANGUAGE="JavaScript"> var useFlash = navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"] && navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin; </SCRIPT> <SCRIPT LANGUAGE="VBScript"> On Error Resume Next useFlash = Not IsNull(CreateObject("ShockwaveFlash.ShockwaveFlash")) </SCRIPT> </head> <body> <SCRIPT LANGUAGE="JavaScript"> if ( useFlash ) { window.location = "pagina_con_flash.htm"; } Else { window.location = "pagina_sin_flash.htm"; } </SCRIPT> </body>

Maximizar una pagina Sencillo script para maximizar una pagina


<html> <head> <script language="JavaScript"> function amplia(){ resizeTo(screen.width, screen.height) moveTo(0, 0); } </script> </head> <body onload="amplia()"> <h1> La Pagina esta Maximizada </h1> </body> </html>

Escapar de Frames Mas popular metodo de escapar de frames o marcos. Este script tambien puede ser muy util para eliminar la publicidad de algunos servidores webs gratuitos asi como de sistemas de redireccionamiento.
<script language="JavaScript"> if(parent.frames.length>=1 { window.top.location.href="/tutores/index.asp". } </script> __________________________________________________ Al indicar top.location.href Obligaremos a toda pagina que contenga este codigo a romper el marco o frame, por lo que nadie podr abrir esta pagina dentro de los marcos <SCRIPT> // CODIGO OBTENIDO EN WWW.TUTORES.ORG function checkStatus() { page = self.location.href; if (page != top.location.href) { top.location.href = page; return true; } } </SCRIPT> <BODY onLoad="checkStatus()";>

A mi parecer esta bueno el script solo algunos errorcillos, pues el function y el if deberian estar en minusculas, que asi si me funciona y el ";" final podrian quitarlo o ponerlo dentr de las comillas de onLoad, por lo demas si esta buenisima y al grano...

Ver codigo fuente de una pagina Tal y como el titulo indica al pulsar el enlace se mostrar el codigo fuente de la url que hayamos indicado, que en este caso es http://www.tutores.org

view-source:http://www.fulltono.com/
<script type="text/javascript"> function verFuente(pagina){ window.location = "view-source:" + pagina ; } </script> <p>Mostrar cdigo fuente: <a href= "javascript:verFuente(window.location);">Pgina actual</a> <a href= "javascript:verFuente('http://www.tutores.org');">tutores.org</a> </p>

Obtener ip del visitante Facil metodo de conseguir la direccion ip de un visitante


<SCRIPT> var ip = new java.net.InetAddress.getLocalHost(); var ipStr = new java.lang.String(ip); document.writeln(ipStr.substring(ipStr.indexOf("/")+1)); </SCRIPT>

No permitir seleccionar en pagina Muchas veces tenemos un texto el cual no queremos que los usuarios copien.

<script language="Javascript"> <!-- Codigo ofrecido por tutores.org function disableselect(e){ return false } function reEnable(){ return true } document.onselectstart=new Function ("return false") if (window.sidebar){ document.onmousedown=disableselect document.onclick=reEnable } // fin --> </script> Intenta seleccionar cualquier texto de esta pagina !!

Bloqueo del teclado Sencillo script que impide la pulsacion del teclado, mostrando una ventana de alerta
<!-- Codigo ofrecido por tutores.org --> <script language="JavaScript">function tecla(){alert('EL TECLADO BLOQUEADO')}; document.onkeydown=tecla;</script>

http://www.tutores.org/?codigos=5&pg=11 Scripts Diversos JavaScript http://www.cssplay.co.uk/menu/index.html Codigos CSS efectos varios

LAS ETIQUETAS META-TAG Las etiquetas metatag o meta tag son una parte imprescindible dentro de cualquier pagina web, ya que estas permiten que nuestra pagina sea indexada por los motores de bsqueda. Aunque es posible enviar nuestra URL a algunos motores de bsqueda, el hecho de enviarla no garantiza que de hecho vaya a ser indexada, por ello la correcta construccin de las etiquetas metatag es de una importancia trascendental. Para los que no estn familiarizados con el diseo web recomendamos la lectura de nuestro captulo "Promocin web: las etiquetas Meta Tag". Para la construccin rpida de las etiquetas meta puedes utilizar gratuitamente nuestro generador de etiquetas meta. Figura 01. Cdigo fuente de un sitio web <html> <head> <TITLE>EL TITULO</TITLE> <META name="description" content="FRASES CLAVE"> <META name="keywords" content="PALABRAS CLAVE"> <META name="language" content="es"> <META name="revisit-after" content="1 month"> <META name="rating" content="General"> <META name="author" content="EL AUTOR"> <META name="owner" content="EL PROPIETARIO"> <META name="robot" content="index, follow"> </head> <body> <H1>Encabezamiento de la pgina Web</H1> Como puedes ver todos los componentes visibles de la pagina Web se encuentran dentro de las etiquetas "body" </body> </html>

Los campos que tienen un valor ya asignado responden a que en muchos casos en el valor idneo, modifcalos bajo tu responsabilidad. http://www.uterra.com/crea_tu_web/promocion_web.htm

Вам также может понравиться