JavaScript DHTML/Window Browser/Browser Title Bar

Материал из Web эксперт
Версия от 10:28, 26 мая 2010; Admin (обсуждение | вклад) (1 версия)
(разн.) ← Предыдущая | Текущая версия (разн.) | Следующая → (разн.)
Перейти к: навигация, поиск

Scrolling Title in Browser title bar

   <source lang="html4strict">

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <script language="javascript"> // (c) Premshree Pillai // http://www.qiksearch.ru // premshree@hotmail.ru // Use freely as long as this message is intact. var msg = " Scrolling Title "; var pos = 0; var spacer = " ... "; var time_length = 100; function ScrollTitle() {

document.title = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos);
pos++;
if (pos > msg.length) pos=0;
window.setTimeout("ScrollTitle()",time_length);

} ScrollTitle(); </script> <style type="text/css"> .premshree{font-family:verdana,arial,helvetica; font-size:8pt; color:#003399; font-weight:normal; text-decoration:underline} .premshree:hover{font-family:verdana,arial,helvetica; font-size:8pt; color:#FA5D00; font-weight:normal; text-decoration:underline} .header{font-family:Times New Roman,arial,verdana,helvetica; font-size:25pt; color:#DD0000; font-weight:bold; font-style:italic} </style> <title>Scrolling Title</title> </head> <body bgcolor="#FFFFFF">

Scrolling Title


This script scrolls the title.
Paste the following script in the <HEAD> section of your page. Change the variable msg to your web page title. Change the scroll speed by changing the value of the variable time_length. Here it is 100, which means that each character will change it"s position after 100 milliseconds, i.e a scroll speed of 10 pixels/second.

<script language="javascript">
// (c) Premshree Pillai
// http://www.qiksearch.ru
// premshree@hotmail.ru
// Use freely as long as this message is intact.
var msg = " Your Web Page Title ";
var pos = 0;
var spacer = " ... ";
var time_length = 100;
function ScrollTitle()
{
document.title = msg.substring(pos, msg.length) + spacer + msg.substring(0, pos);
pos++;
if (pos > msg.length) pos=0;
window.setTimeout("ScrollTitle()",time_length);
}
ScrollTitle();
</script>

<a href="mailto:premshree@hotmail.ru" class="premshree">&#169 Premshree Pillai</a>

</body> </html>

      </source>