Este codigo javascript simula un efecto muy parecido al que utilizan las peliculas de Flash (.swf), muy bueno!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
<!-- Quotation Scroller v1.0 by Angus Turnbull http://gusnz.cjb.net Updated: 15 Feb 2001 Secondary Redirect: http://www.bigfoot.com/~angus_rt --> <html><title> text effects Flash</title> <body bgcolor="#ffffff" scroll="no"> <script type="text/javascript"> <!-- // Hide var isDOM = false, isNS4 = false; if (document.all) var isDOM = true, docObj = 'document.all.', styObj = '.style'; else if (document.layers) var isNS4 = true, docObj = 'document.', styObj = ''; var quotes = new Array(); c = 0; quotes[c] = 'So Long, And Thanks For All The Fish'; c++; quotes[c] = 'Yomama so...'; c++; quotes[c] = 'Nothing lasts forever but the tomato'; c++; quotes[c] = 'mmmm... chocolaaateahrghlly...'; c++; quotes[c] = 'Very funny Scotty, now beam down my clothes!'; c++; quotes[c] = 'Who let the dogs out?'; c++; quotes[c] = 'Dang it... the boy ain\'t right'; c++; quotes[c] = 'Shrimp gumbo, shrimp patties, shrimp...'; c++; quotes[c] = 'Och aye th\' noo!'; c++; quotes[c] = 'Respect my authoritaah!'; c++; quotes[c] = 'So cunning you could stick a tail on it and call it a weasel'; c++; quotes[c] = 'And I\'d say, "Oi! You! NO!"'; c++; quotes[c] = 'That\'s a one, spicy! meat-a-ball!'; c++; quotes[c] = 'The world is a vampire...'; c++; quotes[c] = 'This is the quote that never ends...'; c++; quotes[c] = 'Screeew you guys, I\'m going home'; c++; quotes[c] = 'The Earth is full. Go home!'; c++; quotes[c] = 'So many pedestrians, so little time...'; c++; var visQuotes = 10; // Maximum onscreen at once. var sDivSty = new Array(visQuotes); var sDivRef = new Array(visQuotes); var speed = new Array(visQuotes); // Left: Low speed colours (lighter) .... Right: High speed colours (darker). var colours = new Array('B2C7DE','A4BCD8','96B2D2','88A8CC','7A9EC6','6C94C0','5E89BA'); function checkDivs() { for (i = 0; i < visQuotes; i++) { // If it's moved offscreen to the left (or starting), set things in motion... if (parseInt(sDivSty[i].left) < (0 - (isDOM ? sDivRef[i].clientWidth : sDivSty[i].clip.width))) { speed[i] = Math.floor(Math.random() * 56) + 8; // Varies: 8 to 63. // Off to the right it goes. sDivSty[i].left = (isDOM ? document.body.clientWidth : window.innerWidth) + Math.random() * 50; // Write a quote in a colour that depends on the speed. /* Stylesheets - guess which browser has bugs :) * * divText = '<nobr><span style="font: ' + speed[i] + 'px Arial, Helvetica; ' + * 'color: #' + colours[Math.floor(speed[i] / 8) - 1] + '">' + * quotes[Math.floor(Math.random() * quotes.length)] + '</span></nobr>'; */ fontSize = Math.floor(speed[i] / 8) - 1; divText = '<nobr><font face="Arial, Helvetica" size="' + fontSize + '" color="#' + colours[fontSize] + '">' + quotes[Math.floor(Math.random() * quotes.length)] + '</font></nobr>'; if (isDOM) sDivRef[i].innerHTML = divText; if (isNS4) { sDivRef[i].document.write(divText); sDivRef[i].document.close(); } // Position and layer it according to its speed (faster = higher). sDivSty[i].zIndex = speed[i]; topMax = (isDOM ? document.body.clientHeight : innerHeight) - speed[i]; sDivSty[i].top = topMax * Math.random(); } // All items: Keep 'em moving left. sDivSty[i].left = parseInt(sDivSty[i].left) - (speed[i] / 4); } } function initDivs() { for (i = 0; i < visQuotes; i++) { divID = 'sDiv' + i.toString(); if (isDOM) document.write('<div id="' + divID + '" style="position: absolute; left: -1000"> </div>'); // Have to use layers, divs are buggy as..... in NS. Again. if (isNS4) document.write('<layer id="' + divID + '" left="-1000"> </layer>'); sDivRef[i] = eval(docObj + 'sDiv' + i); sDivSty[i] = eval(docObj + 'sDiv' + i + styObj); } setInterval('checkDivs()', 50); } if (isDOM || isNS4) initDivs(); // End Hide --> </script> <div id="mainText" style="position: absolute; left: 100; top: 200; z-index: 100"> <h1>'Ello 'ello 'ello what 'ave we 'ere then?</h1> <div> </body> </html> |