0% found this document useful (0 votes)
2 views13 pages

Javascript s

The document contains JavaScript code snippets for various web functionalities, including opening a full-screen window, changing the status bar text, and creating pop-up alerts. It emphasizes the importance of providing users with the ability to close windows to avoid feelings of entrapment. Additionally, it includes examples of image manipulation, cursor changes, and scrolling text effects.

Uploaded by

Vero CH
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views13 pages

Javascript s

The document contains JavaScript code snippets for various web functionalities, including opening a full-screen window, changing the status bar text, and creating pop-up alerts. It emphasizes the importance of providing users with the ability to close windows to avoid feelings of entrapment. Additionally, it includes examples of image manipulation, cursor changes, and scrolling text effects.

Uploaded by

Vero CH
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Abrir el navegador a pantalla completa

<SCRIPT LANGUAGE="JavaScript">

<!-- Begin

/*
En la URL es nomalmente mejor usar direcciones relativas
hasta la página que vas a abrir con este script; si no,
IE puede perder las proporciones de la ventana y puede dar
algunos errores. No olvides dar al navegante alguna forma de
cerrar la ventana para evitar la sensación de ahogo que
puede producir verse atrapado en una ventana sin salida.
*/

// pon aquí la página a la que vas a ir


url = "[Link]";

// pon lo rapido que se va a expandir horizontalmente la ventana


// un número más bajo implica menor velocidad
var speedX = 7;

// pon aquí lo rápido que se va a expandir verticalemtente la ventana


// un número más bajo implica menor velocidad

var speedY = 5;

// elige el color de la pantalla de "Cargando web"


var bgColor = "#000000";

// elige el color del texto "Cargando web"


var txtColor = "#FF80000";

// no toques nada a partir de aquí


// ---------------------------
if ([Link]) {
var wide = [Link];
var high = [Link];
}
function andBoom() {
if ([Link]) {
var Boomer = [Link]("","BoomWindow","fullscreen");
[Link]('<HTML><BODY BGCOLOR='+bgColor+'
SCROLL=NO><FONT FACE=ARIAL COLOR='+txtColor+'>Cargando
web</FONT></BODY></HTML>');
[Link]();
for (H=1; H<high; H+= speedY) {
[Link](1,H);
}
for (W=1; W<wide; W+= speedX) {
[Link](W,H);
}
[Link] = url;
}
else {
[Link](url,"BoomWindow","");
}
}
// End -->
En cualquier parte

</script>

<a href="javascript:andBoom()">Pincha aquí para entrar</a>


<BR>

No olvides dear a tus visitantes una oportunidad para cerrar la ventana y evitar que
se sientan agobiados. Usa esto en la página que enseñes a pantalla completa:
<a href="javascript:[Link]();">Pincha aquí para cerrar esta ventana</a>

Abrir web a pantalla completa


Head

<script>
<!--
function fullwin(){
[Link]("http.//[Link]","","fullscreen,scrollbars")
}
//-->
</script>

body

<form>
<input type="button" onClick="fullwin()" value="Entrar">
</form>

cerrar ventana

<a href="javascript:[Link]();">Pincha aquí para cerrar esta ventana</a>

INFORMACION SOBRE LOS LINKS

<body onLoad="loadalert()">
<script>
function showtip(tip){
[Link]=tip
}
</script>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><p align="center"><strong>
<font face="Arial" size="3"> <a href="[Link]"
onMouseover="showtip('Aquí tienes todos los scripts que necesitas')"
onMouseout="showtip('')">JavaScripts</a> | </font>
<font face="Arial"><a href="[Link]" onMouseover="showtip('Un montón
de ideas para dar a conocer tu página')" onMouseout="showtip('')">Promoción
web</a> | </font>
<font face="Arial" size="3"><a
href="[Link]" onMouseover="showtip('Miles de gráficos y gifs animados para
dar a conocer tu página')" onMouseout="showtip('')">Gifs animados</a>
</font></strong>
</td>
</tr>
<tr>
<td width="100%"><form name="tool">
<div align="center"><center><p><input type="text" name="tip"
size="69" STYLE="BACKGROUND=#F0F0FF; BORDER:0"></p>
</center></div>
</form>
</td>
</tr>
</table>

scroll de texto en la barra de estado

HEAD

<SCRIPT LANGUAGE="JavaScript">
var texto=" Aquí puedes poner el texto que quieras ";
var longitud=[Link];
function scroll() {
texto=[Link](1,longitud-1)+[Link](0);
[Link] = texto;
setTimeout("scroll()",200);
}
</SCRIPT>

BODY

onLoad="scroll();"

Cambia el texto de la barra de estado al pasar el ratón

DESPUÉS DEL PARÁMETRO HREF

onMouseOver="[Link]='Mensaje'; return true;"

POP PUP
<head>
<script LANGUAGE="Javascript">
function abrirventana()
{
ventana=[Link]('[Link]','','width=253,height=61,top=100,left=150')
}
</script>
</head>

Anula el boton derecho del raton

<script language=JavaScript>
function click(){
if([Link]==2){
alert('mensaje');
}
}
[Link]=click
//-->
</script>

Imágenes junto a los links

BODY
<SCRIPT Language="JavaScript1.1">
<!--
var menuImg0 = "[Link]"
var menuImg1 = "[Link]"

function changeImgOver(imgName){
[Link] = menuImg1
}

function changeImgOut(imgName){
[Link] = menuImg0
}
//-->
</SCRIPT>

LOS ENLACES SERAN ASI

<IMG SRC="[Link]" WIDTH=20 HEIGHT=20 BORDER=0


NAME="link1">
<A HREF="[Link]" onMouseOver="changeImgOver(link1)"
onMouseOut="changeImgOut(link1)">Aquí el título de tu dirección</A>
<BR>

CAMBIAR EL CURSOR
HEAD
<STYLE TYPE="text/css">
a { cursor: crosshair }
</STYLE>
MENSAJE DE BIENVENIDA

<head>
<script language="JavaScript">

function loadalert ()

{alert("Este es el mensaje que saldrá al de cargar la página")

}
</script>
</head>

SCROLL HACIA LA IZDA

<head>
<script language="JavaScript">

function scrollit(seed)
{
var m1 = " Mensaje en barra de estado ";
var msg=m1;
var out = " ";
var c = 0;
if (seed > 100)

{
seed--;
var cmd="scrollit(" + seed + ")";
timerTwo=[Link](cmd,7);

}
else
if (seed <= 100 && seed > 0)
{
for (c=0 ; c < seed ; c++)
{
out+=" ";
}
out+=msg;
seed--;

var cmd="scrollit(" + seed + ")";

[Link]=out;

timerTwo=[Link](cmd,7);

}
else if (seed <= 0)

if (-seed < [Link])

out+=[Link](-seed,[Link]);

seed--;

var cmd="scrollit(" + seed + ")";

[Link]=out;

timerTwo=[Link](cmd,7);

else

[Link]=" ";

timerTwo=[Link]("scrollit(100)",75);

// --End Hiding Here -->

</script>
</head>

<body onLoad="timerONE=[Link]('scrollit(100)',500)">

SCROLL CON LETRAS ALEATORIAS

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.


// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at [Link]

// set speed of banner (pause in milliseconds between addition of new character)


var speed = 10 // decrease value to increase speed (must be positive)

// set pause between completion of message and beginning of following message


var pause = 1500 // increase value to increase pause

// set initial values


var timerID = null
var bannerRunning = false

// create array
var ar = new Array()

// assign the strings to the array's elements


ar[0] = "frase numero 1"
ar[1] = "frase numero 2"
ar[2] = "frase numero 3"
ar[3] = "frase numero 4"

// assign index of current message


var message = 0

// empty string initialization


var state = ""

// no value is currently being displayed


clearState()

// stop the banner if it is currently running


function stopBanner() {
// if banner is currently running
if (bannerRunning)
// stop the banner
clearTimeout(timerID)

// banner is now stopped


bannerRunning = false
}

// start the banner


function startBanner() {
// make sure the banner is stopped
stopBanner()

// start the banner from the current position


showBanner()
}
// assign state a string of "0" characters of the length of the current message
function clearState() {
// initialize to empty string
state = ""

// create string of same length containing 0 digits


for (var i = 0; i < ar[message].length; ++i) {
state += "0"
}
}

// display the current message


function showBanner() {
// if the current message is done
if (getString()) {
// increment message
message++

// if new message is out of range wrap around to first message


if ([Link] <= message)
message = 0

// new message is first displayed as empty string


clearState()

// display next character after pause milliseconds


timerID = setTimeout("showBanner()", pause)

// banner is now running


bannerRunning = true
} else {
// initialize to empty string
var str = ""

// built string to be displayed (only character selected thus far are displayed)
for (var j = 0; j < [Link]; ++j) {
str += ([Link](j) == "1") ? ar[message].charAt(j) : " "
}

// partial string is placed in status bar


[Link] = str

// add another character after speed milliseconds


timerID = setTimeout("showBanner()", speed)

// banner is now running


bannerRunning = true
}
}
function getString() {
// set variable to true (it will stay true unless proven otherwise)
var full = true

// set variable to false if a free space is found in string (a not-displayed char)


for (var j = 0; j < [Link]; ++j) {
// if character at index j of current message has not been placed in displayed string
if ([Link](j) == 0)
full = false
}

// return true immediately if no space found (avoid infinitive loop later)


if (full)
return true

// search for random until free space found (braoken up via break statement)
while (1) {
// a random number (between 0 and [Link] - 1 == [Link] - 1)
var num = getRandom(ar[message].length)

// if free space found break infinitive loop


if ([Link](num) == "0")
break
}

// replace the 0 character with 1 character at place found


state = [Link](0, num) + "1" + [Link](num + 1, [Link])

// return false because the string was not full (free space was found)
return false
}

function getRandom(max) {
return [Link]((max - 1) * [Link]())
}

// -->
</SCRIPT>
</head>

<BODY onLoad="startBanner()">

Texto letra a letra en la barra de estado

HEAD
<script language="JavaScript">
<!--
var startMsg = "Estas son las letras llegando a la barra de estado.";
var str = "";
var msg = "";
var leftMsg = "";
function setMessage()
{
if (msg == "")
{
str = " ";
msg = startMsg;
leftMsg = "";
}
if ([Link] == 1)
{
while ([Link](0, 1) == " ")
{
leftMsg = leftMsg + str;
str = [Link](0, 1);
msg = [Link](1, [Link]);
}
leftMsg = leftMsg + str;
str = [Link](0, 1);
msg = [Link](1, [Link]);
for (var ii = 0; ii < 120; ii++)
{
str = " " + str;
}
}
else
str = [Link](10, [Link]);
[Link] = leftMsg + str;
timeout = [Link]('setMessage()',5);
}
// -->
</script>

BODY
onload="timeout = [Link]('setMessage()',500);"

SSCROLL DE DCHA A IZDA

<head>
<SCRIPT LANGUAGE="JavaScript">
<!--

// Copyright (c) 1996-1997 Tomer Shiran. All rights reserved.


// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at [Link]

function scrollBanner(seed) {
// set pause in milliseconds between each movement
var speed = 10
// assign one-space string to variable (space pads left side of status bar)
var str = " "

// create global array


var ar = new Array()

// assign the strings to the array's elements


ar[0] = "Hola :) esto es el script "
ar[1] = " [Link] coleccion de applets de java "
ar[2] = " y otros recursos gratuitos para webmasters"
ar[3] = " no dejes de visitarnos ... vuelve cuando quieras ..."

// join all messages to one string variable with no delimiter


var total = [Link]("")

// if message has not yet reached the left side of the status bar
if (seed > 0) {
// assign string of seed spaces to variable
for (var i = 0; i < seed; ++i) {
str += " "
}

// append message to end of output string


str += total

// message moved one position to the left


seed--

// assign expression containing recursive call with literal argument in form of string
var cmd = "scrollBanner(" + seed + ")"

// place computed message in status bar


[Link] = str

// recursive call after speed milliseconds


timerID = setTimeout(cmd, speed)
} else
// if a substring of the total message still remains in status bar
if (-seed < [Link]) {
// assign part of message that has not slided off the left
str += [Link](-seed, [Link])

// message has moved one position to the left


seed--

// assign expression containing recursive call with literal argument in form of string
var cmd = "scrollBanner(" + seed + ")"

// place computed message in status bar


[Link] = str

// recursive call after speed milliseconds


timerID = setTimeout(cmd, speed)
} else {
// assign a one-space string to status bar
[Link] = str

// recursive call after speed milliseconds at initial position


timerID = setTimeout("scrollBanner(100)", speed)
}
}

// -->
</SCRIPT>
</head>

<body onLoad="scrollBanner(100)">

TEXTO DE COLORES

<script language="JavaScript">
<!-- Hide the script from old browsers --
// Michael P. Scholtis (mpscho@[Link])
// All rights reserved. January 15, 1996
// You may use this JavaScript example as you see fit, as long as the
// information within this comment above is included in your script.
function MakeArray(n){
[Link]=n;
for(var i=1; i<=n; i++) this[i]=i-1;
return this
}
hex=new MakeArray(16);
hex[11]="A"; hex[12]="B"; hex[13]="C"; hex[14]="D"; hex[15]="E"; hex[16]="F";
function ToHex(x){ // Changes a int to hex (in the range 0 to 255)
var high=x/16;
var s=high+""; //1
s=[Link](0,2); //2 the combination of these are the same as the trunc function
high=parseInt(s,10); //3
var left=hex[high+1]; // left part of the hex-value
var low=x-high*16; // calculate the rest of the values
s=low+""; //1
s=[Link](0,2); //2 the combination of these are the same as the trunc function
low=parseInt(s,10); //3
var right=hex[low+1]; // right part of the hex-value
var string=left+""+right; // add the high and low together
return string;
}
function rainbow(text){
text=[Link](3,[Link]-4); // gets rid of the HTML-comment-tags
color_d1=255; // any value in 'begin' 0 to 255
mul=color_d1/[Link];
for(i=0;i < [Link];i++){
color_d1=255*[Link](i/([Link]/3)); // some other things you can try >> "=255-
mul*i" to fade out, "=mul*i" to fade in, or try "255*[Link](i/([Link]/3))"
color_h1=ToHex(color_d1);
color_d2=mul*i;
color_h2=ToHex(color_d2);
[Link]("<FONT
COLOR='#FF"+color_h1+color_h2+"'>"+[Link](i,i+1)+'</FONT>');
}
}
// --End Hiding Here -->
</script>
</head>

<body>
<SCRIPT>
<!--
{rainbow("--> Aquí va el Texto <!--");}
//-->
</SCRIPT>
</body>

You might also like