JavaScripts -> Texteffekt -> Langsam blinkender Text

Bei diesem Script blinkt ein Text als Werbewirkung etc. langsam ein- und ausfadend.

Kompatibilität getestet:
Beispiel Anzeigen >>

Script-Code

<script type="text/javascript">
<!--
// = = ======================================================================== = =
// = = Pulsing Text Banner v1.0 (c) 2004 Triple-M / http://www.htmlarsenal.de = =
// = = ======================================================================== = =

// --------------------------------------------------------------------------------
// -- Dieses Script und viele andere im --
// -- This script and many more in the --
// --------------------------------------------------------------------------------
// -- HTML ARSENAL - Die Quelle für HTML, JavaScript, PHP --
// -- HTML ARSENAL - Your Source for HTML, JavaScript, PHP --
// --------------------------------------------------------------------------------
// -- -= http://www.htmlarsenal.de =- --
// --------------------------------------------------------------------------------

// Sie dürfen dieses Script für nicht-kommerzielle Zwecke nutzen, wenn diese Urheber-Notiz erhalten bleibt.
// You may use this Script for non-commercial causes as long as you include this copyright notice.

// Benutzung / Usage
// =================

// Fügen Sie einfach ein Script mit dem Inhalt pulse("Ihr Text") an der Stelle ein, an der der Text erscheinen soll.
// Simply include a script with the content pulse("your text") at the position where the text shall be displayed.

// Veränderbare Einstellungen / Adjustable settings
// ================================================

var bg_r=0xe0; // \
var bg_g=0xe0; // |- Hintergrundfarbe (R,G,B - #123456 wird zu 0x12, 0x34, 0x56)
var bg_b=0xe0; // / background color (r,g,b - #123456 becomes 0x12, 0x34, 0x56)

var fg_r=0xc0; // \
var fg_g=0x20; // |- Vordergrundfarbe (R,G,B - #123456 wird zu 0x12, 0x34, 0x56)
var fg_b=0x20; // / foreground color (r,g,b - #123456 becomes 0x12, 0x34, 0x56)

var border="1px solid #c02020"; // CSS-Rahmenangabe / css border style
var font="Verdana"; // Schriftart / font
var font_size="14px"; // Schriftgröße (CSS) / font size (CSS)
var font_weight="bold"; // Schriftschnitt (bold=fett, normal=normal) / font weight (CSS)

var delay=50; // Pause zwischen den Schritten / delay between the steps
var steps=8; // Anzahl der Schritte für den Farbübergang / number of steps for fading the colors

// Script-Code
// ===========

// Ab hier bitte nichts mehr verändern
// Please do not change anything from here on

function rgb2h(R,G,B) {
  var RGB="#";
  if(R<16)RGB+="0";
  RGB+=R.toString(16);
  if(G<16)RGB+="0";
  RGB+=G.toString(16);
  if(B<16)RGB+="0";
  RGB+=B.toString(16);
  return RGB;
}

function pulse(text) {
  var dir=1, step=0, id;
  id="p_"+Math.floor(Math.random()*10000);
  document.write('<span id="'+id+'" style="padding:1px; border:'+border+'; font-family:'+font+'; font-size:'+font_size+'; font-weight:'+font_weight+'; background-color:'+rgb2h(bg_r,bg_g,bg_b)+'; color:'+rgb2h(bg_r,bg_g,bg_b)+'">'+text+'<\/span>');
  window.setTimeout("dothepulse('"+id+"',"+dir+","+step+")",delay);
}

function dothepulse(id,dir,step) {
  step+=dir;
  if(step>=steps)dir=-1;
  if(step<=0)dir=1;
  document.getElementById(id).style.color=rgb2h(bg_r+Math.floor(((fg_r-bg_r)*step)/steps),bg_g+Math.floor(((fg_g-bg_g)*step)/steps),bg_b+Math.floor(((fg_b-bg_b)*step)/steps));
  window.setTimeout("dothepulse('"+id+"',"+dir+","+step+")",delay);
}

// ----------------------------
// -- Ende / End Script-Code --
// ----------------------------
// -- Pulsing Text Banner --
// -- Author: Triple-M --
// -- www.htmlarsenal.de --
// -- 21.Mar.2004 --
// ----------------------------


//-->
</script>