Помогите! Почему-то нет вызова моей функции setcolor? - вопрос №1029915

<!DOCTYPE html>

<html>

<head>

<title>Label Env</title>

</head>

<body id=«mybody»>

<script type=«text/JavaScript» language=«JavaScript»>

var brush = 'blue'

var s = new String()

s = palitra()

document.write(s)

function setcolor(color)
{
alert('setcolor')
 
brush = color;
idcolor.style.backgroundColor = brush;

}

function palitra()
{

var s

alert('palitra')
 
s = '<table cellspacing=0 cellpadding=0>'

s += '<tr>'

s += '<td>'
 
s += '<table cellspacing=0 cellpadding=0 width=28 height=28><tr><td id=«idcolor» bgColor=' + brush + '> </td></tr></table>'

s += '</td>'

s += '<td>'

s += '<table border=1 cellspacing=0 cellpadding=0 title=«select color»>'// onmouseover=«window.status = \»select color\"">'

s += '<tr>'

s += '<td width=15 height=15 bgColor=#000000 onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ff0000 onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#00ff00 onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffff00 onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#0000ff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ff00ff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#00ffff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffffff onclick=setcolor(#ff0000)> </td>'

s += '</tr>'

s += '<tr>'

s += '<td width=15 height=15 bgColor=#aaaaaa onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffaaaa onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#aaffaa onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffffaa onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#aaaaff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffaaff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#aaffff onclick=setcolor(#ff0000)> </td>'
s += '<td width=15 height=15 bgColor=#ffffff onclick=setcolor(#ff0000)> </td>'

s += '</tr>'

s += '</table>'
 
s += '</td>'

s += '</tr>'

s += '</table>'
 
return s

}

</script>

</body>

</html>

Ответы

Потому что помимо ее обьявления ее нужно вызвать.
14.08.15

Alexander

Читать ответы
Посмотреть всех экспертов из раздела Технологии > Создание сайтов
Пользуйтесь нашим приложением Доступно на Google Play Загрузите в App Store