Bueno mi primer aporte en este foro de java aqui les boy a dejar unos cuantos codes de java scrip de la coleccion q tengo ai si gustan uno que quieran me lo piden a lomejor esta en mi lista si no esta pss ya ni modo.
CODIGOS
Texto en forma de montaña rusa.
Ejemplo: http://www.cyberiapc.com/aascripter/samples/TextEffects/sub1.htm
Funciona en:
Código: <script>
/*
Roller Coaster Script-
By Website Abstraction
Over 200+ free scripts here!
*/
var fs=1
var direction="right"
function rollertext(whichone){
var thetext=whichone
for (i=0;i<thetext.length;i++){
document.write(thetext.charAt(i).fontsize(fs))
if (fs<7&&direction=="right")
fs++
else if (fs==7){
direction="left"
fs--
}
else if (fs==1){
direction="right"
fs++
}
else if (fs>1&&direction=="left")
fs--
}
}
//Change below text to your won
rollertext("Life is like a roller coaster ride. Hang on tight!")
</script>
Texto marquesina dentro de un formulario
Ejemplo: http://www.cyberiapc.com/aascripter/samples/TextEffects/sub7.htm
Funciona en:
este dentro de las etiquetas <HEAD> Y </HEAD>
Código: <script language="JavaScript">
<!-- Hide the script from non-JavaScript browsers --
// This script was found at the JavaScript Place. http://www.javaplace.co.uk
var timerID = null;
var timerRunning = false;
var id,pause=0,position=0;
function ticker() {
var i,k,msg=" Your important and interesting messages go here .......... ";
k=(75/msg.length)+1;
for(i=0;i<=k;i++) msg+=" "+msg;
document.form2.ticker.value=msg.substring(position,position+100);
if(position++==38) position=0;
id=setTimeout("ticker()",1000/10); }
function action() {
if(!pause) {
clearTimeout(id);
pause=1; }
else {
ticker();
pause=0; } }
// --End hiding script from non-JavaScript browsers -->
</script>
y Este dentro de las etiquetas <BODY> Y </BODY>
Código: <BODY onLoad="ticker ()">
<CENTER><H3>Ticker Tape scrolling message
demo</H3></CENTER>
<P>
<FORM NAME="form2">
<INPUT TYPE="text" name="ticker" size="82">
</FORM>
<P>
Back to the <A HREF="index.html">index</A> page
Presentacion de Imagenes cambiandolas con un boton
Ejemplo: http://www.cyberiapc.com/aascripter/samples/ImageSound/sub3.htm
Funciona en:
Código: <table border="0" cellpadding="0">
<caption><strong>Air Show Photos</strong></caption>
<tr>
<td width="100%"><img src="plane1.gif" width="300" height="240" name="photoslider"></td>
</tr>
<tr>
<td width="100%"><form method="POST" name="rotater">
<div align="center"><center><p><script language="JavaScript1.1">
var photos=new Array()
var which=0
/*Change the below variables to reference your own images. You may have as many images in the slider as you wish*/
photos[0]="plane1.gif"
photos[1]="plane2.gif"
photos[2]="plane3.gif"
photos[3]="plane4.gif"
photos[4]="plane5.gif"
function backward(){
if (which>0){
window.status=''
which--
document.images.photoslider.src=photos[which]
}
}
function forward(){
if (which<photos.length-1){
which++
document.images.photoslider.src=photos[which]
}
else window.status='End of gallery'
}
</script><input type="button" value="<<Back" name="B2"
onClick="backward()"> <input type="button" value="Next>>" name="B1"
onClick="forward()"><br>
<a href="#" onClick="which=1;backward();return false"><small>Start Over</small></a></p>
</center></div>
</form>
</td>
</tr>
</table>
Imagen aleatoria de fondo al cargar la pagina
Ejemplo: http://www.cyberiapc.com/aascripter/samples/ImageSound/sub1.htm
Funciona en:
Código: <script>
/*Random Background Image-
By Website Abstraction (www.wsabstract.com)
More free JavaScripts here!
*/
var backgr1="../clip/backgr4.jpg"
var backgr2="../clip/backgr17.jpg"
var backgr3="../clip/backgr13.jpg"
var cur=Math.round(6*Math.random())
if (cur<=1)
backgr=backgr1
else if (cur<=4)
backgr=backgr2
else
backgr=backgr3
document.write('<body background="'+backgr+'" bgcolor="#FFFFFF">')
</script>
Seleccion de imagen con un formilario deslisante
Ejemplo: http://www.cyberiapc.com/aascripter/samples/ImageSound/sub6.htm
Funciona en:
entre las etiquetas <HEAD> Y </HEAD>
Código: <script language="javascript">
<!--
/*Combo Box Image Selector:
By Website Abstraction (www.wsabstract.com)
Over 200+ free JavaScript here!
*/
function showimage()
{
if (!document.images)
return
document.images.pictures.src=
document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value
}
//-->
</script>
Entre las etiquetas <BODY> Y </BODY>
Código: <table border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100%"><form name="mygallery"><p><select
name="picture" size="1" onChange="showimage()">
<option selected value="me.gif">Picture of me</option>
<option value="myaunt.gif">Picture of my aunt</option>
<option value="brother.gif">Picture of my brother</option>
</select></p>
</form>
</td>
</tr>
<tr>
<td width="100%"><p align="center"><img src="me.gif" name="pictures" width="99"
height="100"></td>
</tr>
</table>
Scroll de ventana asia avajo
Ejemplo: http://www.cyberiapc.com/aascripter/samples/Browser/sub1.htm
Funciona en:
Entre las etiquietas <BODY> Y </BODY>
Código: <script language="JavaScript1.2">
/*
Top-Down scrolling window Script-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more free DHTML scripts, and Terms Of
Use, visit dynamicdrive.com
*/
//change 1 to another integer to alter the scroll speed. Greater is faster
var speed=1
var currentpos=0,alt=1,curpos1=0,curpos2=-1
function initialize(){
startit()
}
function scrollwindow(){
if (document.all)
temp=document.body.scrollTop
else
temp=window.pageYOffset
if (alt==0)
alt=1
else
alt=0
if (alt==0)
curpos1=temp
else
curpos2=temp
if (curpos1!=curpos2){
if (document.all)
currentpos=document.body.scrollTop+speed
else
currentpos=window.pageYOffset+speed
window.scroll(0,currentpos)
}
else{
currentpos=0
window.scroll(0,currentpos)
}
}
function startit(){
setInterval("scrollwindow()",10)
}
window.onload=initialize
</script>
Mini venta que corre por toda la pantalla (con pagina personalisable)
Ejemplo: http://www.cyberiapc.com/aascripter/samples/Browser/sub14.htm
Funciona en:
Entre las etiquetas <HEAD> Y </HEAD>
Código: <Script Language="JavaScript1.2">
<!-- Hiding
/* Java Script by Lefteris Haritou 5/05/1997
http://www.geocities.com/SiliconValley/7096
Please do not remove the above credit !
No copyrights, but just be fair
*/
var x=0;
var y=0;
var plus=1;
function start(){
nw=window.open("","wd","scrolbar=0,toolbar=0,status=0");
window.nw.resizeTo(200,100);
window.nw.moveTo(0,0)
nw.document.open();
nw.document.writeln('<HTML><BODY onBlur="self.focus()" Bgcolor="#FFFFF0"><CENTER><BR><font face="Arial" color="#0000FF" size=4>Cool New Features Of Netscape 4</font></CENTER></BODY></HTML>');
nw.document.close();
gvar();
}
function earthquake(){
window.nw.moveBy(x,y);
gvar();
}
function gvar(){
if (plus==1){
if (x<35){
x+=1;
window.setTimeout("earthquake()",200);
}
else{
if (y<29){
y+=1;
window.setTimeout("earthquake()",200);
}
else{
plus=0;
x=0;
y=0;
gvar();
}
}
}
else{
if (x>-35){
x-=1;
window.setTimeout("earthquake()",200);
}
else{
if (y>-29){
y-=1;
window.setTimeout("earthquake()",200);
}
else{
fine();
}
}
}
}
function gvarm(){
if (y>0){
y-=1;
window.setTimeout("earthquake()",200);
}
else{
if (x>0){
x-=1;
window.setTimeout("earthquake()",200);
}
else{
fine();
}
}
}
function fine(){
alert("Demo presented to you by Lefteris Haritou \n http://www.geocities.com/~lef");
nw.close();
clearTimeout();
}
// Done Hiding -->
</Script>
Entre las Etiquetas <BODY> Y </BODY>
Código: <CENTER>
<Form>
<Input type="button" Value="Begin" onclick="start()">
</Form>
</CENTER>
Código: <!----------------- PLEASE ATTACH THIS IF USED -------------->
<meta name=author
content="Raul R. Edwards">
<meta name=copyright
content="Software Angel, Inc. (c) April 1, 1999"> <meta license=GNU
content="GNU General Public License Version 1.2
as published by the Free Software Foundation"
<!----------------------------------------------------------->
<style>
body { background:silver; font-family:Arrus BT,Garamond,Times New
Roman; }
div { position:absolute; }
</style>
<title>Emboss & 3D Letters</title>
<head>
<body>
Written by<br>
<style>
a { text-decoration: none; color:maroon; vlink:maroon; alink:red;}
a:hover {color: red }
.info { font-family:Times New Roman; positon:relative;}
.light { top:-1; left:-1; color:white;}
.shade { top:+1; left:+1; color:pink; }
.fill { top:0; left:0; color:red; } </style>
<div class="info">
<div class="light">
<i>Software Angel, Inc.</i>
</div>
<div class="shade">
<i>Software Angel, Inc.</i>
</div>
<div class="fill">
<i>
<a href="mailto:rre@scs.howard.edu"
onmouseover="status='Software Angel, Inc. © 1999'; return true;"
onmouseout="status='Emboss & 3D Letters'; return true;">
Software Angel, Inc.</a>
</i>
</div>
</div>
<br><br><br>
<!--- Example #1 --->
<style>
.shade1 { top:+5; left:+5; color:black; }
.fill1 { top:0; left:0; color:red; }
</style>
<div class=Example1>
<div class="shade1">
<center><h1>Shadow</h1></center>
</div>
<div class="fill1">
<center><h1>Shadow</h1></center>
</div>
</div>
<br><br><br>
<!--- Example #2 --->
<style>
.light2 { top:-1; left:-2; color:white; }
.shade2 { top:+1; left:+2; color:black; }
.fill2 { top:0; left:0; color:silver; } </style>
<div class=Example2>
<div class="light2">
<center><h1>Emboss Background Example</h1></center>
</div>
<div class="shade2">
<center><h1>Emboss Background Example</h1></center>
</div>
<div class="fill2">
<center><h1>Emboss Background Example</h1></center>
</div>
</div>
<br><br><br>
<!--- Example #3 --->
<style>
.light3 { top:-2; left:-2; color:white; }
.shade3 { top:+2; left:+2; color:lightblue; }
.fill3 { top:0; left:0; color:blue; } </style>
<div class=Example3>
<div class="light3">
<center><h1>Emboss Color Example</h1></center>
</div>
<div class="shade3">
<center><h1>Emboss Color Example</h1></center>
</div>
<div class="fill3">
<center><h1>Emboss Color Example</h1></center>
</div>
</div>
<br><br><br>
<!--- Example #4 --->
<style>
.light4 { top:-2; left:-2; color:yellow; }
.shade4 { top:+2; left:+2; color:yellow; }
.fill4 { top:0; left:0; color:darkgreen; } </style>
<div class=Example4>
<div class="light4">
<center><h1>Color Highlight Example</h1></center>
</div>
<div class="shade4">
<center><h1>Color Highlight Example</h1></center>
</div>
<div class="fill4">
<center><h1>Color Highlight Example</h1></center>
</div>
</div>
Texto en grande que salta por toda la pantalla
Ejemplo: http://www.cyberiapc.com/aascripter/samples/TextEffects/sub12.htm
Funciona en:
entre las etiquetas <BODY> Y </BODY>
Código: <style type="text/css">
#supertext {
position:absolute;
left:0;
top:0;
visibility:hide;
visibility:hidden;
}
</style>
<script language="JavaScript1.2">
/*
Bouncy message script- By Dynamicdrive.com
Code based on Lloyd Hassell's, at http://www.dynamicdrive.com/dynamicindex4/bounceimage.htm
For full source, TOS, and 100s DTHML scripts, visit http://dynamicdrive.com
*/
//Configure the below three variables
//1) Set message to display (HTML accepted)
var thecontent='<h2><font color="#0000FF">Welcome to Dynamic Drive!</font></h2>'
//2) Set delay after which message should be hidden, in miliseconds ('' makes it incessantly visible on the screen)
var hidetimer='';
//3) Set speed of animation (1-50), where larger is faster
var BallSpeed = 20;
///NO NEED TO EDIT BELOW THIS LINE///////////
var contentWidth;
var contentHeight;
var maxBallSpeed = 50;
var xMax;
var yMax;
var xPos = 0;
var yPos = 0;
var xDir = 'right';
var yDir = 'down';
var superballRunning = true;
var tempBallSpeed;
var currentBallSrc;
var newXDir;
var newYDir;
function initializeBall() {
if (document.all) {
xMax = document.body.clientWidth
yMax = document.body.clientHeight
document.all("supertext").style.visibility = "visible";
contentWidth=supertext.offsetWidth
contentHeight=supertext.offsetHeight
}
else if (document.layers) {
xMax = window.innerWidth;
yMax = window.innerHeight;
contentWidth=document.supertext.document.width
contentHeight=document.supertext.document.height
document.layers["supertext"].visibility = "show";
}
setTimeout('moveBall()',400);
if (hidetimer!='')
setTimeout("hidetext()",hidetimer)
}
function moveBall() {
if (superballRunning == true) {
calculatePosition();
if (document.all) {
document.all("supertext").style.left = xPos + document.body.scrollLeft;
document.all("supertext").style.top = yPos + document.body.scrollTop;
}
else if (document.layers) {
document.layers["supertext"].left = xPos + pageXOffset;
document.layers["supertext"].top = yPos + pageYOffset;
}
animatetext=setTimeout('moveBall()',20);
}
}
function calculatePosition() {
if (xDir == "right") {
if (xPos > (xMax - contentWidth - BallSpeed)) {
xDir = "left";
}
}
else if (xDir == "left") {
if (xPos < (0 + BallSpeed)) {
xDir = "right";
}
}
if (yDir == "down") {
if (yPos > (yMax - contentHeight - BallSpeed)) {
yDir = "up";
}
}
else if (yDir == "up") {
if (yPos < (0 + BallSpeed)) {
yDir = "down";
}
}
if (xDir == "right") {
xPos = xPos + BallSpeed;
}
else if (xDir == "left") {
xPos = xPos - BallSpeed;
}
else {
xPos = xPos;
}
if (yDir == "down") {
yPos = yPos + BallSpeed;
}
else if (yDir == "up") {
yPos = yPos - BallSpeed;
}
else {
yPos = yPos;
}
}
function hidetext(){
if (document.all)
supertext.style.visibility="hidden"
else if (document.layers)
document.supertext.visibility="hide"
clearTimeout(animatetext)
}
if (document.all||document.layers){
document.write('<span id="supertext"><nobr>'+thecontent+'</nobr></span>')
window.onload = initializeBall;
window.onresize = new Function("window.location.reload()");
}
</script>
Efecto texto en desvanesimiento con scroll (muy bueno)
Ejemplo: http://www.cyberiapc.com/aascripter/samples/TextEffects/sub15.htm
Funciona en:
entre las etiquetas <HEAD> Y </HEAD>
Código: <style TYPE="text/css">
<!--
.TextScrollStyle {
visibility:hidden;
font-family:Verdana;
font-weight:bold;
text-align:center;
padding:0;
margin:0;
width:100%;
overflow:hidden;
}
-->
</style>
<script language="JavaScript1.2">
/*
Dynamic Fader Script (updated: 00/08/05)
Created and submitted by Nicholas Poh (hwinmain@yahoo.com) to
Dynamicdrive.com
Key modifications by Dynamic Drive for stability/ efficiency in NS
For full source code, usage terms, and 100s more scripts, visit
http://dynamicdrive.com
*/
//1) Configure messages:
var TS_message = new Array();
TS_message[0] = '<div align="left">Hello there</div>';
TS_message[1] = '<div align="left">Wow... hope you
like it!</div>';
TS_message[2] = '<div align="left">Script downloaded from
<A HREF="http://www.cyberiapc.com">CyberiaPC.com</A></div>';
//2) Configure fader width and colors:
var TS_scrollwidth=400 //configure fader width
var TS_colorFG = 0x000000; // Text color
var TS_colorBG = 0xFFFFFF; //bgColor
// uncomment any value you wanted to change
//var TS_ymax = 50;
// How many pixel to move
//var TS_ystep = 1;
// 1 or -1 only (Scroll direction)
//var TS_speed = 2;
// The smaller the value the faster
//var TS_pause = 100;
// Pause time(milisecond) between messages
var TS_fadestep= 20;
// Steps to fade in and out
if (document.all)
document.write('<style>#containerarea{width:'+TS_scrollwidth+'}</style
>')
</script>
Entre las etiquetas <BODY> Y </BODY>
Código: <DIV id="containerarea">
<SCRIPT LANGUAGE="JavaScript1.2" SRC="textfader.js"></SCRIPT>
</DIV>
______________
Ultima edición por shadow-anime el Lun Oct 13, 2008 12:57 am; editado 5 veces
|