Strict Standards: Resource ID#28 used as offset, casting to integer (28) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401

Strict Standards: Resource ID#30 used as offset, casting to integer (30) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401

Strict Standards: Resource ID#31 used as offset, casting to integer (31) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/fm.class.php on line 401
ТвойWeb :: Версия для печати :: Помогоите понять ошибку
ТвойWeb » WebMaster класс » JavaScript » Помогоите понять ошибку

Страниц (1): [1]
 

1. Black Stork KCO - 05 Августа, 2007 - 08:10:58 - перейти к сообщению
C Явой дела раньше практически не имел. Сейчас приспичило. С точки зрения моей логики, все написано верно. Но не работает. Итак.

Есть выпадающий список с таким кодом:
CODE:

<select name="guide_select" id="guide_select" style="width: 200px;font-family: verdana; font-size: 12px;" onchange="
for (i=1; i<=6; i++)
if (this.options[this.selectedIndex].value==i)
show_layers('s'+i);
else hide_layers('s'+i);">
<option value="1">.....</option>
.....
<option value="6">.....</option>
</select>

Далбше расположены шесть div'ов с именами 's1' ... 's6'. Все, кроме одного скрыты.

Ну и две используемые функции:
CODE:

function show_layers(id)
{
document.getElementById(id).style.display='block';
}

function hide_layers(id)
{
document.getElementById(id).style.display='none';
}


IE ругается на вызов show_layers
2. ETC - 05 Августа, 2007 - 08:22:13 - перейти к сообщению
В onChange надо написать исключительно вызов своей функции, а не писать тонну скрипта.
3. Black Stork KCO - 05 Августа, 2007 - 08:26:01 - перейти к сообщению
Все равно ошибка.
Сделал так:

CODE:

<script type="text/javascript">
function show_guide (s){
for (i=1; i<=6; i++)
if (s==i)
show_layers('s'+i);
else hide_layers('s'+i);
}
function show_layers(id)
{
document.getElementById(id).style.display='block';
}

function hide_layers(id)
{
document.getElementById(id).style.display='none';
}
</script>

и
CODE:
<select name="guide_select" id="guide_select" style="width: 200px;font-family: verdana; font-size: 12px;" onchange="show_guide(this.options[this.selectedIndex].value);">

Все равно ошибка
4. ETC - 05 Августа, 2007 - 08:26:59 - перейти к сообщению
Ну правильно, вызываешь одну функцию, а описана другая.
5. Black Stork KCO - 05 Августа, 2007 - 08:28:37 - перейти к сообщению
Все, проблема исчерпана.
Косяк был не в этом.

Форум на AlfaSpace.NET


Powered by ExBB
ExBB FM 1.0 RC1 by TvoyWeb.ru
InvisionExBB Style converted by Markus®

[Script Execution time: 0.0317]     [ Gzipped ]



Notice: ob_end_flush(): failed to send buffer of ob_gzhandler (1) in /home/tvoyweb/domains/tvoyweb.ru/public_html/forums/include/page_tail.php on line 33