Табло
ГлянутиСкрипт:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<title>Новая страница 1</title>
</head>
<body>
<script language="JavaScript"><!--
var messages = new Array()
messages[0] = "mnvk"
messages[1] = "shenkevich.s"
messages[2] = "2012"
messages[3] = "verhniy rogachik"
messages[4] = "javascript"
messages[5] = "zaproshiemo"
messages[6] = "зaxoдite!!!"
messages[7] = "http://informkab.at.ua"
// число миллисекунд между двумя сообщениями
var pause = 3000
// установить нормальное расстояние между двумя символами
var space = 1
// установить высоту и ширину каждого символа
var height = 5
var width = 5
var letters = new letterArray()
var on = new Image(5, 5)
var off = new Image(5, 5)
// установить расположение изображения
on.src = "http://informkab.at.ua/tablo/on.gif"
off.src = "http://informkab.at.ua/tablo/off.gif"
var imageNum = document.images.length
// вычислить ширину табло
//var boardWidth = longest * (width + space) - space
// установить максимальную длину сообщения
var boardWidth = 0
for (var i = 0; i < messages.length; ++i) {
var lengthWithNoSpaces = messages[i].split(" ").join("").length
var numberOfSpaces = messages[i].length - lengthWithNoSpaces
var currentBoardWidth = lengthWithNoSpaces * (width + space) - space + numberOfSpaces * space * 2
if (boardWidth < currentBoardWidth)
boardWidth = currentBoardWidth
}
var running = false
var timerID = null
function letterArray() {
this.a = new Array(height)
this.a[0] = " ***"
this.a[1] = "* *"
this.a[2] = "*****"
this.a[3] = "* *"
this.a[4] = "* *"
this.b = new Array(height)
this.b[0] = "****"
this.b[1] = "* *"
this.b[2] = "****"
this.b[3] = "* *"
this.b[4] = "****"
this.c = new Array(height)
this.c[0] = " ***"
this.c[1] = "* *"
this.c[2] = "*"
this.c[3] = "* *"
this.c[4] = " ***"
this.d = new Array(height)
this.d[0] = "****"
this.d[1] = "* *"
this.d[2] = "* *"
this.d[3] = "* *"
this.d[4] = "****"
this.e = new Array(height)
this.e[0] = "*****"
this.e[1] = "*"
this.e[2] = "****"
this.e[3] = "*"
this.e[4] = "*****"
this.f = new Array(height)
this.f[0] = "*****"
this.f[1] = "* "
this.f[2] = "****"
this.f[3] = "* "
this.f[4] = "* "
this.g = new Array(height)
this.g[0] = " ****"
this.g[1] = "*"
this.g[2] = "* ***"
this.g[3] = "* *"
this.g[4] = " ***"
this.h = new Array(height)
this.h[0] = "* *"
this.h[1] = "* *"
this.h[2] = "*****"
this.h[3] = "* *"
this.h[4] = "* *"
this.i = new Array(height)
this.i[0] = "*****"
this.i[1] = " *"
this.i[2] = " *"
this.i[3] = " *"
this.i[4] = "*****"
this.j = new Array(height)
this.j[0] = " *"
this.j[1] = " *"
this.j[2] = " *"
this.j[3] = "* *"
this.j[4] = " ***"
this.k = new Array(height)
this.k[0] = "* *"
this.k[1] = "* *"
this.k[2] = "****"
this.k[3] = "* *"
this.k[4] = "* *"
this.l = new Array(height)
this.l[0] = "*"
this.l[1] = "*"
this.l[2] = "*"
this.l[3] = "*"
this.l[4] = "*****"
this.m = new Array(height)
this.m[0] = "* *"
this.m[1] = "** **"
this.m[2] = "* * *"
this.m[3] = "* * *"
this.m[4] = "* *"
this.n = new Array(height)
this.n[0] = "* *"
this.n[1] = "** *"
this.n[2] = "* * *"
this.n[3] = "* **"
this.n[4] = "* *"
this.o = new Array(height)
this.o[0] = " ***"
this.o[1] = "* *"
this.o[2] = "* *"
this.o[3] = "* *"
this.o[4] = " ***"
this.p = new Array(height)
this.p[0] = "****"
this.p[1] = "* *"
this.p[2] = "****"
this.p[3] = "*"
this.p[4] = "*"
this.q = new Array(height)
this.q[0] = " ***"
this.q[1] = "* *"
this.q[2] = "* *"
this.q[3] = "*** *"
this.q[4] = " ***"
this.r = new Array(height)
this.r[0] = "****"
this.r[1] = "* *"
this.r[2] = "****"
this.r[3] = "* *"
this.r[4] = "* *"
this.s = new Array(height)
this.s[0] = " ****"
this.s[1] = "* "
this.s[2] = " ***"
this.s[3] = " *"
this.s[4] = "****"
this.t = new Array(height)
this.t[0] = "*****"
this.t[1] = " *"
this.t[2] = " *"
this.t[3] = " *"
this.t[4] = " *"
this.u = new Array(height)
this.u[0] = "* *"
this.u[1] = "* *"
this.u[2] = "* *"
this.u[3] = "* *"
this.u[4] = " ***"
this.v = new Array(height)
this.v[0] = "* *"
this.v[1] = "* *"
this.v[2] = "* *"
this.v[3] = " * *"
this.v[4] = " *"
this.w = new Array(height)
this.w[0] = "* *"
this.w[1] = "* *"
this.w[2] = "* * *"
this.w[3] = "* * *"
this.w[4] = " * *"
this.x = new Array(height)
this.x[0] = "* *"
this.x[1] = "* *"
this.x[2] = " ***"
this.x[3] = "* *"
this.x[4] = "* *"
this.y = new Array(height)
this.y[0] = "* *"
this.y[1] = "* *"
this.y[2] = " ***"
this.y[3] = " *"
this.y[4] = " *"
this.z = new Array(height)
this.z[0] = "*****"
this.z[1] = " *"
this.z[2] = " * "
this.z[3] = " * "
this.z[4] = "*****"
this['б'] = new Array(height)
this['б'][0] = "*****"
this['б'][1] = "*"
this['б'][2] = "****"
this['б'][3] = "* *"
this['б'][4] = "****"
this['г'] = new Array(height)
this['г'][0] = "*****"
this['г'][1] = "*"
this['г'][2] = "*"
this['г'][3] = "*"
this['г'][4] = "*"
this['д'] = new Array(height)
this['д'][0] = " **"
this['д'][1] = " * *"
this['д'][2] = " * *"
this['д'][3] = "*****"
this['д'][4] = "* *"
this['ж'] = new Array(height)
this['ж'][0] = "* * *"
this['ж'][1] = "* * *"
this['ж'][2] = " ***"
this['ж'][3] = "* * *"
this['ж'][4] = "* * *"
this['з'] = new Array(height)
this['з'][0] = " ***"
this['з'][1] = "* *"
this['з'][2] = " **"
this['з'][3] = "* *"
this['з'][4] = " ***"
this['и'] = new Array(height)
this['и'][0] = "* *"
this['и'][1] = "* **"
this['и'][2] = "* * *"
this['и'][3] = "** *"
this['и'][4] = "* *"
this['й'] = new Array(height)
this['й'][0] = "* * *"
this['й'][1] = "* **"
this['й'][2] = "* * *"
this['й'][3] = "** *"
this['й'][4] = "* *"
this['л'] = new Array(height)
this['л'][0] = " ***"
this['л'][1] = " * *"
this['л'][2] = " * *"
this['л'][3] = " * *"
this['л'][4] = "* *"
this['п'] = new Array(height)
this['п'][0] = "*****"
this['п'][1] = "* *"
this['п'][2] = "* *"
this['п'][3] = "* *"
this['п'][4] = "* *"
this['у'] = new Array(height)
this['у'][0] = "* *"
this['у'][1] = "* *"
this['у'][2] = " ****"
this['у'][3] = " *"
this['у'][4] = " ***"
this['ф'] = new Array(height)
this['ф'][0] = " ***"
this['ф'][1] = "* * *"
this['ф'][2] = "* * *"
this['ф'][3] = " ***"
this['ф'][4] = " *"
this['ц'] = new Array(height)
this['ц'][0] = "* *"
this['ц'][1] = "* *"
this['ц'][2] = "* *"
this['ц'][3] = "* *"
this['ц'][4] = "*****"
this['ч'] = new Array(height)
this['ч'][0] = "* *"
this['ч'][1] = "* *"
this['ч'][2] = " ****"
this['ч'][3] = " *"
this['ч'][4] = " *"
this['ш'] = new Array(height)
this['ш'][0] = "* *"
this['ш'][1] = "* * *"
this['ш'][2] = "* * *"
this['ш'][3] = "* * *"
this['ш'][4] = "*****"
this['щ'] = new Array(height)
this['щ'][0] = "* **"
this['щ'][1] = "* **"
this['щ'][2] = "* **"
this['щ'][3] = "* **"
this['щ'][4] = "*****"
this['ъ'] = new Array(height)
this['ъ'][0] = "**"
this['ъ'][1] = " *"
this['ъ'][2] = " ***"
this['ъ'][3] = " * *"
this['ъ'][4] = " ***"
this['ы'] = new Array(height)
this['ы'][0] = "* *"
this['ы'][1] = "* *"
this['ы'][2] = "** *"
this['ы'][3] = "* * *"
this['ы'][4] = "** *"
this['ь'] = new Array(height)
this['ь'][0] = "*"
this['ь'][1] = "*"
this['ь'][2] = "****"
this['ь'][3] = "* *"
this['ь'][4] = "****"
this['э'] = new Array(height)
this['э'][0] = " ***"
this['э'][1] = "* *"
this['э'][2] = " ***"
this['э'][3] = "* *"
this['э'][4] = " ***"
this['ю'] = new Array(height)
this['ю'][0] = "* *"
this['ю'][1] = "* * *"
this['ю'][2] = "*** *"
this['ю'][3] = "* * *"
this['ю'][4] = "* *"
this['я'] = new Array(height)
this['я'][0] = " ****"
this['я'][1] = "* *"
this['я'][2] = " ****"
this['я'][3] = " * *"
this['я'][4] = "* *"
this['!'] = new Array(height)
this['!'][0] = " *"
this['!'][1] = " *"
this['!'][2] = " *"
this['!'][3] = ""
this['!'][4] = " *"
this[':'] = new Array(height)
this[':'][0] = ""
this[':'][1] = " *"
this[':'][2] = ""
this[':'][3] = " *"
this[':'][4] = ""
this['.'] = new Array(height)
this['.'][0] = ""
this['.'][1] = ""
this['.'][2] = ""
this['.'][3] = ""
this['.'][4] = "*"
this[','] = new Array(height)
this[','][0] = ""
this[','][1] = ""
this[','][2] = ""
this[','][3] = " *"
this[','][4] = "*"
this['='] = new Array(height)
this['='][0] = ""
this['='][1] = "*****"
this['='][2] = ""
this['='][3] = "*****"
this['='][4] = ""
this['+'] = new Array(height)
this['+'][0] = " *"
this['+'][1] = " *"
this['+'][2] = "*****"
this['+'][3] = " *"
this['+'][4] = " *"
this['-'] = new Array(height)
this['-'][0] = ""
this['-'][1] = ""
this['-'][2] = "*****"
this['-'][3] = ""
this['-'][4] = ""
this['/'] = new Array(height)
this['/'][0] = " *"
this['/'][1] = " *"
this['/'][2] = " *"
this['/'][3] = " *"
this['/'][4] = "*"
this['\\'] = new Array(height)
this['\\'][0] = "*"
this['\\'][1] = " *"
this['\\'][2] = " *"
this['\\'][3] = " *"
this['\\'][4] = " *"
this['"'] = new Array(height)
this['"'][0] = " * *"
this['"'][1] = " * *"
this['"'][2] = " * *"
this['"'][3] = ""
this['"'][4] = ""
this["'"] = new Array(height)
this["'"][0] = " *"
this["'"][1] = " *"
this["'"][2] = " *"
this["'"][3] = ""
this["'"][4] = ""
this['('] = new Array(height)
this['('][0] = " *"
this['('][1] = " *"
this['('][2] = " *"
this['('][3] = " *"
this['('][4] = " *"
this[')'] = new Array(height)
this[')'][0] = "*"
this[')'][1] = " *"
this[')'][2] = " *"
this[')'][3] = " *"
this[')'][4] = "*"
this['*'] = new Array(height)
this['*'][0] = ""
this['*'][1] = " *"
this['*'][2] = " ***"
this['*'][3] = " * *"
this['*'][4] = ""
this['?'] = new Array(height)
this['?'][0] = "****"
this['?'][1] = " *"
this['?'][2] = " **"
this['?'][3] = ""
this['?'][4] = " *"
this['0'] = new Array(height)
this['0'][0] = "*****"
this['0'][1] = "* *"
this['0'][2] = "* *"
this['0'][3] = "* *"
this['0'][4] = "*****"
this['1'] = new Array(height)
this['1'][0] = "***"
this['1'][1] = " *"
this['1'][2] = " *"
this['1'][3] = " *"
this['1'][4] = "*****"
this['2'] = new Array(height)
this['2'][0] = "*****"
this['2'][1] = " *"
this['2'][2] = "*****"
this['2'][3] = "*"
this['2'][4] = "*****"
this['3'] = new Array(height)
this['3'][0] = "*****"
this['3'][1] = " *"
this['3'][2] = "*****"
this['3'][3] = " *"
this['3'][4] = "*****"
this['4'] = new Array(height)
this['4'][0] = "* *"
this['4'][1] = "* *"
this['4'][2] = "*****"
this['4'][3] = " *"
this['4'][4] = " *"
this['5'] = new Array(height)
this['5'][0] = "****"
this['5'][1] = "*"
this['5'][2] = "****"
this['5'][3] = " *"
this['5'][4] = "****"
this['6'] = new Array(height)
this['6'][0] = " ***"
this['6'][1] = "*"
this['6'][2] = "****"
this['6'][3] = "* *"
this['6'][4] = " ***"
this['7'] = new Array(height)
this['7'][0] = "*****"
this['7'][1] = " *"
this['7'][2] = " *"
this['7'][3] = " *"
this['7'][4] = "*"
this['8'] = new Array(height)
this['8'][0] = " ***"
this['8'][1] = "* *"
this['8'][2] = " ***"
this['8'][3] = "* *"
this['8'][4] = " ***"
this['9'] = new Array(height)
this['9'][0] = " ***"
this['9'][1] = "* *"
this['9'][2] = " ****"
this['9'][3] = " *"
this['9'][4] = " ***"
}
function drawBlank() {
var gt = unescape("%3e")
document.write('<TABLE BGCOLOR="#000000" BORDER=2 CELLPADDING=8' + gt + '<TR' + gt + '<TD BGCOLOR ALIGN="center" VALIGN="center"' + gt)
for (var y = 0; y < height; ++y) {
for (var x = 0; x < boardWidth; ++x) {
document.write('<IMG SRC="' + off.src + '" HEIGHT=5 WIDTH=5' + gt)
}
document.write('<BR' + gt)
}
document.write('</TD' + gt + '</TR' + gt + '</TABLE' + gt)
}
function setLight(state, x, y) {
if (state)
document.images[computeIndex(x, y)].src = on.src
else
document.images[computeIndex(x, y)].src = off.src
}
function drawLetter(letter, startX) {
// нарисовать букву на данных Х координатах
for (var x = 0; x < width; ++x) {
for (var y = 0; y < height; ++y) {
setLight(letters[letter][y].charAt(x) == "*", startX + x, y)
}
}
}
function drawSpace(startX) {
// создать небольшое расстояние между двумя символами
for (var x = 0; x < space; ++x) {
for (var y = 0; y < height; ++y) {
setLight(false, startX + x, y)
}
}
}
function computeIndex(x, y) {
return (y * boardWidth + x) + imageNum
}
function floodBoard(startX) {
for (var x = startX; x < boardWidth; ++x) {
for (var y = 0; y < height; ++y) {
setLight(false, x, y)
}
}
}
function drawMessage(num) {
var text = messages[num]
var i = 0
var j = 0
while (1) {
if (text.charAt(j) != " ") {
// нарисовать текущую букву
drawLetter(text.charAt(j), i)
i += width
} else {
drawSpace(i)
i += space
}
if (j < text.length - 1) {
drawSpace(i)
i += space
} else
break
++j
}
floodBoard(i)
if (num < messages.length - 1)
val = ++num
else
val = 0 // запустить цикл с начала
timerID = setTimeout("drawMessage(val)", pause)
}
function startSign() {
running = true
// подождать 3 секунды, затем вызвать функцию для вывода первого сообщения
drawMessage(0)
}
function stopSign() {
if(running)
clearTimeout(timerID)
running = false
}
// открыть форму
document.write
drawBlank()
<startSign()
// --></script>
<br>
</body>
</html>