Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Ejemplo
<script language="JavaScript1.2">
function tremer(n) {
if (self.moveBy) {
for (i = 10; i > 0; i--) {
for (j = n; j > 0; j--) {
self.moveBy(0,i);
self.moveBy(i,0);
self.moveBy(0,-i);
self.moveBy(-i,0);
}}}}
tremer(5)
</script>
Ejemplo
<script language="JavaScript">
<!-- Oculto para browsers antiguos
// Este y otros JavaScripts
// en - http://www.gratisss.bizland.com
Ejemplo
Clic sobre la frase que contiene el vnculo. Puedes pegar este vnculo
tantas veces quieras y cambiarles la ruta desde "Propiedades de
Hipervnculo"..
<script LANGUAGE="JavaScript">
function janelanimada(endereco) {
var velocidadev = 15;
var topo = 0;
var esquerda = 0;
var velocidadeh = 15;
if (document.all) {
var tamlar = window.screen.availHeight - topo;
var tamjan = window.screen.availWidth - esquerda;
var tamanho = window.open("","","left=" + esquerda + ",top=" + topo +
",width=1,height=1,scrollbars=yes");
for (sizeheight = 1; sizeheight < tamlar; sizeheight += velocidadev) {
tamanho.resizeTo("1",sizeheight );}
for (sizewidth = 1; sizewidth < tamjan; sizewidth += velocidadeh) {
tamanho.resizeTo(sizewidth+6,sizeheight );}
tamanho.location = endereco;}
else
window.location = endereco;}
</script>
<p><a href="http://www.galeon.com/estilista"
onClick="janelanimada('http://www.yomaster.galeon.com');return
false;">Google,buscador</a><br>
Anular botn de la derecha
<!-- Botn derecho del mouse -->
<script LANGUAGE="JavaScript1.1">
function derecha(e) {
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)){
alert('Botn derecho inhabilitado')
return false;
}
<script LANGUAGE="JavaScript1.1">
function izquierda(e) {
if (navigator.appName == 'Netscape' && (e.which == 1 || e.which == 2)){
alert('Botn izquierdo inhabilitado')
return false;
}
<script LANGUAGE="JavaScript1.1">
function ambos(e) {
if (navigator.appName == 'Netscape' && (e.which == 1 || e.which == 3 || e.which == 2))
{
alert('Los botones del mouse han sido inhabilitados')
return false;
}
<script language="JavaScript">
<!--
function show5(){
if (!document.layers&&!document.all&&!document.getElementById)
return
var dn="PM"
if (hours<12)
dn="AM"
if (hours>12)
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='5' face='Arial' ><b><font size='1'>Hora
actual:</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)
}
window.onload=show5
//-->
</script>
<script>
var montharray=new
Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
function countup(yr,m,d){
var today=new Date()
var todayy=today.getYear()
if (todayy < 1000)
todayy+=1900
var todaym=today.getMonth()
var todayd=today.getDate()
var todaystring=montharray[todaym]+" "+todayd+", "+todayy
var paststring=montharray[m-1]+" "+d+", "+yr
var difference=(Math.round((Date.parse(todaystring)-Date.parse(paststring))/
(24*60*60*1000))*1)
difference+=" das"
document.write("Hace "+difference+" que LosRecursosGratis.com estan ayudando a los
webmasters!")
}
//webmaster esta es la fecha a cambiar
countup(2001,04,14)
</script>
<script languaje="JavaScript">
</script>
Cuenta atrs para cerrar una ventana
<!-- Colocar en la etiqueta <BODY> -->
onLoad="begintimer()"
<script>
<!--
<style>
//How much of the layer do you wan't to be visible when it's in the out state?
lshow=60
//Do you want it to move with the page if the user scroll the page?
var moveOnScroll=true
/
**********************************************************************
**********
You should't have to change anything below this.
**********************************************************************
**********/
//Defining variables
var tim;
var ltop;
//Object constructor
function makeMenu(obj,nest){
nest=(!nest) ? '':'document.'+nest+'.'
this.css=(n) ? eval(nest+'document.'+obj):eval(obj+'.style')
this.state=1
this.go=0
this.width=n?this.css.document.width:eval(obj+'.offsetWidth')
this.left=b_getleft
this.obj = obj + "Object"; eval(this.obj + "=this")
}
//Get's the top position.
function b_getleft(){
var gleft=(n) ? eval(this.css.left):eval(this.css.pixelLeft);
return gleft;
}
/
**********************************************************************
**********
Deciding what way to move the menu (this is called onmouseover, onmouseout or
onclick)
**********************************************************************
**********/
function moveMenu(){
if(!oMenu.state){
clearTimeout(tim)
mIn()
}else{
clearTimeout(tim)
mOut()
}
}
//Menu in
function mIn(){
if(oMenu.left()>-oMenu.width+lshow){
oMenu.go=1
oMenu.css.left=oMenu.left()-move
tim=setTimeout("mIn()",menuSpeed)
}else{
oMenu.go=0
oMenu.state=1
}
}
//Menu out
function mOut(){
if(oMenu.left()<0){
oMenu.go=1
oMenu.css.left=oMenu.left()+move
tim=setTimeout("mOut()",menuSpeed)
}else{
oMenu.go=0
oMenu.state=0
}
}
/
**********************************************************************
**********
Checking if the page is scrolled, if it is move the menu after
**********************************************************************
**********/
function checkScrolled(){
if(!oMenu.go) oMenu.css.top=eval(scrolled)+ltop
if(n) setTimeout('checkScrolled()',30)
}
/
**********************************************************************
**********
Inits the page, makes the menu object, moves it to the right place,
show it
**********************************************************************
**********/
function menuInit(){
oMenu=new makeMenu('divMenu')
scrolled=n?"window.pageYOffset":"document.body.scrollTop"
oMenu.css.left=-oMenu.width+lshow
ltop=(n)?oMenu.css.top:oMenu.css.pixelTop;
oMenu.css.visibility='visible'
if(moveOnScroll) ie?window.onscroll=checkScrolled:checkScrolled();
}
<style>
body{
overflow-x:hidden;
overflow-y:scroll;
}
</style>
<!-- Colocar dentro de la etiqueta <BOBY> - cambia los enlaces y titulos por los de tu
web-->
<script language="JavaScript1.2">
/*
Scrollable Menu Links- By Dynamicdrive.com
For full source, TOS, and 100s DTHML scripts
Visit http://dynamicdrive.com
var actualwidth=''
var ns_scroll
function fillup(){
if (document.all){
test2.innerHTML=menucontents
actualwidth=test2.offsetWidth
}
else if (document.layers){
ns_scroll=document.ns_scrollmenu.document.ns_scrollmenu2
ns_scroll.document.write(menucontents)
ns_scroll.document.close()
actualwidth=ns_scroll.document.width
}
}
window.onload=fillup
function moveleft(){
if (document.all&&test2.style.pixelLeft>(menuwidth-actualwidth))
test2.style.pixelLeft-=scrollspeed
else if (document.layers&&ns_scroll.left>(menuwidth-actualwidth))
ns_scroll.left-=scrollspeed
lefttime=setTimeout("moveleft()",50)
}
function moveright(){
if (document.all&&test2.style.pixelLeft<0)
test2.style.pixelLeft+=scrollspeed
else if (document.layers&&ns_scroll.left<0)
ns_scroll.left+=scrollspeed
righttime=setTimeout("moveright()",50)
}
if (document.all||document.layers){
with (document){
write('<table border="0" cellspacing="0" cellpadding="0">')
write('<td valign="middle"><a href=#" onMouseover="moveleft()"
onMouseout="clearTimeout(lefttime)"><img src="'+goleftimage+'"border=0></a>
</td>')
write('<td valign="top">')
if (document.all){
write('<span style="position:relative;width:'+menuwidth+';">')
write('<span style="position:absolute;width:'+menuwidth+';clip:rect(0 '+menuwidth+'
auto 0)">')
write('<span id="test2" style="position:absolute;left:0;top:0">')
write('</span></span></span>')
}
else if (document.layers){
write('<ilayer width='+menuwidth+' name="ns_scrollmenu">')
write('<layer name="ns_scrollmenu2" left=0 top=0></layer></ilayer>')
}
write('</td>')
write('<td valign="middle"> <a href="#" onMouseover="moveright()"
onMouseout="clearTimeout(righttime)">')
write('<img src="'+gorightimage+'"border=0></a>')
write('</td></table>')
}
}
</script>
Precarga de imgenes
<!-- Dentro del tag HEAD -->
<script language="JavaScript1.2">
<!-- begin hiding
//
// Autor 2000 Marcin P Wojtowicz [one_spook@hotmail.com].
// Traducido, doblado y adaptado por http://www.losrecursosgratis.com
//
startingColor[0] = "c"
startingColor[1] = "f"
startingColor[2] = "f"
endingColor[0] = "c"
endingColor[1] = "0"
endingColor[2] = "0"
var gap = 5
if (!document.all) location.replace(locationAfterPreload)
var a = 10, b = 11, c = 12, d = 13, e = 14, f=15, i, j, ones = new Array(), sixteens = new
Array(), diff = new Array();
var convert = new Array("0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"),
imgLen = tusimagenes.length;
var loaded = new Array(), preImages = new Array(), currCount = 0, pending = 0, h = 0,
hilite = new Array(), cover = new Array();
var num = Math.floor(preloadbarWidth/gap);
for (i = 0; i < 3; i++) {
startingColor[i] = startingColor[i].toLowerCase();
endingColor[i] = endingColor[i].toLowerCase();
startingColor[i] = eval(startingColor[i]);
endingColor[i] = eval(endingColor[i]);
diff[i] = (endingColor[i]-startingColor[i])/num;
ones[i] = Math.floor(diff[i]);
sixteens[i] = Math.round((diff[i] - ones[i])*15);
}
endingColor[0] = 0;
endingColor[1] = 0;
endingColor[2] = 0;
i = 0, j = 0;
while (i <= num) {
hilite[i] = "#";
while (j < 3) {
hilite[i] += convert[startingColor[j]];
hilite[i] += convert[endingColor[j]];
startingColor[j] += ones[j];
endingColor[j] += sixteens[j];
if (endingColor[j] > 15) {
endingColor[j] -= 15;
startingColor[j]++;
}
j++;
}
j = 0;
i++;
}
function loadImages() {
for (i = 0; i < imgLen; i++) {
preImages[i] = new Image();
preImages[i].src = tusimagenes[i];
loaded[i] = 0;
cover[i] = Math.floor(num/imgLen)*(i+1)
}
cover[cover.length-1] += num%imgLen
checkLoad();
}
function checkLoad() {
if (pending) { changeto(); return }
if (currCount == imgLen) { location.replace(locationAfterPreload); return }
for (i = 0; i < imgLen; i++) {
if (!loaded[i] && preImages[i].complete) {
loaded[i] = 1; pending++; currCount++;
checkLoad();
return;
}
}
setTimeout("checkLoad()",10);
}
function changeto() {
if (h+1 > cover[currCount-1]) {
var percent = Math.round(100/imgLen)*currCount;
if (percent > 100) while (percent != 100) percent--;
if (currCount == imgLen && percent < 100) percent = 100;
defaultStatus = "Loaded " + currCount + " out of " + imgLen + " images
[" + percent + "%].";
pending--;
checkLoad();
return;
}
eval("document.all.cell" + (h+1) + ".style.backgroundColor = hilite[h]");;
h++;
setTimeout("changeto()",1);
}
defaultStatus = "Loaded 0 out of " + imgLen + " images [0%]."
// end hiding -->
</script>
<center>
<font face="Verdana, Arial, Helvetica" size="2"><center>Cargando imagenes de la
pgina... Por Favor, espere..</center>
<script language="JavaScript1.2">
<!-- beging hiding
document.write('<table border="0" cellpadding="0" cellspacing="0" width="' +
preloadbarWidth + '"><tr height="' + preloadbarHeight + '" bgcolor="' +
backgroundOfGradient + '">');
for (i = 0; i < num; i++) {
document.write('<td width="' + gap + '" id="cell' + (i+1) + '"></td>');
}
document.write('</tr></table>');
<style type="text/css">
BODY {
scrollbar-face-color: #CC3333;
scrollbar-shadow-color: #000000;
scrollbar-highlight-color: #000000;
scrollbar-3dlight-color: #999999;
scrollbar-darkshadow-color: #505050;
scrollbar-track-color: #cccccc;
scrollbar-arrow-color: #cccccc;
}
</style>
Oculta la direccin en la barra de estado
<!-- Copiar dentro del tag BODY -->
<!-- Codigo ofrecido por http://www.losrecursosgratis.com -->
<a href="http://la_direccion_que_quieras_que_aparezca"
onClick="javascript:window.location='http://La_Direccion_verdadera'
return false">Texto a indicar</a>
Buscadores mltiples (I)
<!-- Copiar este cdigo dentro del tag HEAD-->
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Adaptado por http://www.losrecursosgratis.com -->
<!-- Begin
Yahoo = "http://search.yahoo.com/bin/search?p=";
Alta = "http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&q=";
Open = "http://search.opentext.com/omw/simplesearch?SearchFor=";
Lycos = "http://www.lycos.com/cgi-bin/pursuit?query=";
Crawler = "http://www.webcrawler.com/cgi-bin/WebQuery?searchText=";
InfoSeek = "http://guide-p.infoseek.com/Titles?qt=";
DejaNews = "http://search.dejanews.com/nph-dnquery.xp?query=";
Inktomi = "http://204.161.74.8:1234/query/?query=";
MetaCrawler = "http://search.go2net.com/crawler?general=";
SavySearch = "http://guaraldi.cs.colostate.edu:2000/search?KW=";
Excite = "http://www.excite.com/search.gw?searchType=Concept&search=";
Magellan = "http://www.mckinley.com/searcher.cgi?query=";
Point = "http://point.lycos.com/cgi-bin/pursuit?query=";
Galaxy = "http://www.einet.net/cgi-bin/wais-text-multi?keywords=";
var got=0;
var url = "";
var plus="";
var mag="";
function search4(item){
stringPlus();
resultsWindow=window.open();
resultsWindow.document.open();
resultsWindow.document.write("<head><title>Close this window "
+ "to return to Search Page</title></head>"
+ "<FRAMESET ROWS=50%,50%><FRAMESET COLS=50%,50%>"
+ "<FRAME NAME='frame0' SRC='" + computeFrameSrc(0) + "'>"
+ "<FRAME NAME='frame1' SRC='" + computeFrameSrc(1) + "'>"
+ "</FRAMESET><FRAMESET COLS=50%,50%><FRAME NAME='frame2' "
+ "SRC='" + computeFrameSrc(2) + "'><FRAME NAME='frame3' "
+ "SRC='" + computeFrameSrc(3) + "'></FRAMESET></FRAMESET>");
resultsWindow.document.close();
got = 0;
}
function search2(item){
stringPlus();
resultsWindow=window.open();
resultsWindow.document.open();
resultsWindow.document.write("<head><title>Close this window "
+ "to return to Total search</title></head><FRAMESET ROWS=50%,50%>"
+ "<FRAME NAME='frame0' SRC='" + computeFrameSrc(0) + "'><FRAME "
+ "NAME='frame1' SRC='" + computeFrameSrc(1) + "'></FRAMESET>");
resultsWindow.document.close();
got = 0;
}
function stringPlus() {
for (var j=0; j < window.document.choose4.text.value.length; j++) {
if (window.document.choose4.text.value.charAt(j) == " ")
mag += "+";
else mag += window.document.choose4.text.value.charAt(j);}
}
function numChecked(item) {
plus = escape(item.text.value);
var h=0;
num=0;
for (var l=0; l < item.check1.length; l++) {
if (item.check1[l].checked) {
h++;
if (h++ <= 4){
if (l == "0"){
num = 1;}
else if (l == "1") num = 2;
else if (l == "2") num = 3;
else if (l == "3") num = 4;
else if (l == "4") num = 5;
else if (l == "5") num = 6;
else if (l == "6") num = 7;
else if (l == "7") num = 8;
else if (l == "8") num = 9;
else if (l == "9") num = 10;
else if (l == "10") num = 11;
else if (l == "11") num = 12;
else if (l == "12") num = 13;
}
}
}
if (h == 2)
Results(num-1);
else if (h == 4)
search2(item);
else
search4(item);
}
function computeFrameSrc(num) {
var k=-1;
for (var j=got; j < document.choose4.check1.length; j++) {
if (document.choose4.check1[j].checked){
k++;
if (k++ <= num){
if (j == "0"){
url = Yahoo + plus;
got = 1;}
else if (j == "1"){
url = Magellan + mag;
got = 2;}
else if (j == "2"){
url = Point + plus;
got = 3;}
else if (j == "3"){
url = Alta + plus + "&mode=and";
got = 4;}
else if (j == "4"){
url = Open + plus + "&mode=and";
got = 5;}
else if (j == "5"){
url = Lycos + plus + "&backlink=217&maxhits=25";
got = 6;}
else if (j == "6"){
url = Excite + plus +
"&category=default&mode=relevance&showqbe=1&display=html3,hb";
got = 7;}
else if (j == "7"){
url = Crawler + plus + "&maxHits=25";
got = 8;}
else if (j == "8"){
url = InfoSeek + plus + "&col=WW";
got = 9;}
else if (j == "9"){
url = DejaNews + plus + "&defaultOp=AND&svcclass=dncurrent&maxhits=25";
got = 10;}
else if (j == "10"){
url = Inktomi + plus + "&hits=25&disp=Text+Only";
got = 11;}
else if (j == "11"){
url = MetaCrawler + plus +
"&method=0&target=ion=0&rpp=20&timeout=5&hpe=10";
got = 12;}
else if (j == "12"){
url = SavySearch + plus +
"&classic=on&t1=x&Boolean=AND&Hits=10&Mode=MakePlan&df=normal&AutoSt
ep=on&AutoInt=on&lb=1";
got = 13;}
return url;
}
}
}
url = "javascript:void(0)";
return url;
}
function Results(place){
stringPlus();
resultsWin = open("","results");
if (place == "0")
url = Yahoo + plus;
else if (place == "1")
url = Magellan + mag;
else if (place == "2")
url = Point + plus;
else if (place == "3")
url = Alta + plus + "&mode=and";
else if (place == "4")
url = Open + plus + "&mode=and";
else if (place == "5")
url = Lycos + plus + "&backlink=217&maxhits=25";
else if (place == "6")
url = Excite + plus +
"&category=default&mode=relevance&showqbe=1&display=html3,hb";
else if (place == "7")
url = Crawler + plus + "&maxHits=25";
else if (place == "8")
url = InfoSeek + plus + "&col=WW";
else if (place == "9")
url = DejaNews + plus + "&defaultOp=AND&svcclass=dncurrent&maxhits=25";
else if (place == "10")
url = Inktomi + plus + "&hits=25&disp=Text+Only";
else if (place == "11")
url = MetaCrawler + plus +
"&logic=0ion=The+World&orgType=Any&maxwait=1&score=0";
else if (place == "12")
url = SavySearch + plus +
"&classic=on&t1=x&Boolean=AND&Hits=10&Mode=MakePlan&df=normal&AutoSt
ep=on&AutoInt=on&lb=1";
resultsWin.location = url;
}
// End -->
</script>
<script language="javascript">
// Los mejores cdigos JavaScript en http://www.losrecursosgratis.com
function mailpage()
{
mail_str = "mailto:nombre@dominio.com?subject=visita esta pgina. Es muy buena!!
" + document.title;
mail_str += "&body=Hola amigo. Te recomiendo que visites esta pgina
LosRecursosGratis.com -- " + document.title;
mail_str += ". Enlace: " + location.href;
location.href = mail_str;
}
</script>
<a HREF="javascript:mailpage()">Recomendar por e-mail esta pgina</a>
_____________________________
Mira este cdigo...
<html>
<head>
</head>
<body id="pageWait">
<FORM>
<INPUT TYPE="BUTTON" VALUE="Activar espera" NAME="btnWait">
</FORM>
<SCRIPT LANGUAGE="VBScript">
Sub btnWait_OnClick
pageWait.style.cursor="wait"
End Sub
</SCRIPT>
</body>
</html>
En cuanto al cdigo, es bastante sencillo... llama al objeto que quieras de una manera,
y despus le cambias la propiedad desde el script... igual que con el body, poda
haberse hecho con una tabla, un rea, un texto... casi lo que fuese.
Si es un problema para t lo que te dije antes de que al pasar por enlaces y botones el
cursor cambia... puedes intentar por ejemplo jugar con capas... es decir, poner una
capa trasparente (etiqueta <DIV>) por encima y cambiarle la propiedad cursor...
cuando quieras volver a como estabas, escondes la capa y ya est... tienes muchas
posibilidades para conseguirlo.
Suerte.