tag:blogger.com,1999:blog-84216509381304818572008-07-25T02:35:34.477-07:00Snowcore's блогunknownnoreply@blogger.comBlogger31125tag:blogger.com,1999:blog-8421650938130481857.post-66085625391469511242008-06-20T07:12:00.000-07:002008-06-20T07:17:36.879-07:00ICQ 12111 SystemВесь мир вздрогнул!<br />20.06.2008 у всех абонентов ICQ появился номер 12111 в группе General. Это троян - удаляйте его и меняйте пароль. Ходят слухи, что AOL number 12111 - это все проделки AOL, но это все-таки вирус! Так что остерегайтесь номера аськи 12111 - если вам не удается его удалить, перезапустите аську и снова попробуйте. Иначе - воспользуйтесь менеджером контактов (можна найти на сайте qip.ru).<br /><br /> Мочите 12111 в своем QIP !!!<br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-3083642971758456012008-05-08T04:40:00.000-07:002008-05-08T04:42:08.013-07:00Уррррряяяяяя!!!Наконец-то я сделал это!<br /><br />Буду собирать вещи и перебираться потихоньку на <a href="http://snowcore.net"><span style="font-size:180%;"><span style="color: rgb(0, 153, 0);">snowcore.net</span></span></a><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-86145532228207552802008-04-10T07:30:00.000-07:002008-04-10T07:33:45.271-07:00Quirks Mode ... IEВсе... моему терпению уже нет конца... В связи с этим на моем блоге поселяется новая картинка НАВСЕГДА (смотрите правый верхний угол).<br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-22993997554988531852008-04-04T07:15:00.000-07:002008-04-04T07:40:02.865-07:00Prevent text selection или отмена выделения текстаПри разработке клиентской части приложения иногда нужно отменить выделение текста, которое делает браузер при двойном клике на элементе или при drag'n'drop.<br />Этого можно избежать, используя объект <span style="font-weight: bold;">document.selection</span>.<br />Пишем простую функцию, которая отменяет выделение текста и задаем ее на соответствующее событие:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> clearSelection<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span><br /><span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> sel;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>document.<span style="color: rgb(0, 102, 0);">selection</span> &amp;&amp; document.<span style="color: rgb(0, 102, 0);">selection</span>.<span style="color: rgb(0, 102, 0);">empty</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> document.<span style="color: rgb(0, 102, 0);">selection</span>.<span style="color: rgb(0, 102, 0);">empty</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>window.<span style="color: rgb(0, 102, 0);">getSelection</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> sel = window.<span style="color: rgb(0, 102, 0);">getSelection</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>sel &amp;&amp; sel.<span style="color: rgb(0, 102, 0);">removeAllRanges</span><span style="color: rgb(102, 204, 102);">)</span><br /> sel.<span style="color: rgb(0, 102, 0);">removeAllRanges</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span><br /><span style="color: rgb(102, 204, 102);">}</span><a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br /><br />А еще проще (и лучше ;-) - используем jQuery плагин <span style="font-weight: bold; color: rgb(0, 153, 0);">jQuery Disable Text Select Plugin</span> <a href="http://www.jdempster.com/2007/07/14/jquery-disable-text-select/">http://www.jdempster.com/2007/07/14/jquery-disable-text-select/</a><br /><br />Подключаем единственный файл jquery.disable.text.select.js и задаем отмену выделения текста для нужных элементов:<br /><br /><div class="javascript" style="font-family: monospace; color: #000000;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#wrapper&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">disableTextSelect</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br /><br /><br /><br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-38323969206736510702008-04-02T06:47:00.000-07:002008-04-02T07:05:21.255-07:00jQuery Обработка щелчка правой кнопки мышиДолго возился, никак не мог найти как задать этот обработчик. Я использую livequery plugin.<br /> Задать обработку можно так:<br /><br /><div class="javascript" style="font-family: monospace; color: #000000;">$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;.pixel&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">livequery</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'contextmenu'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp; <span style="color: #009900; font-style: italic;">// do something ...&nbsp; &nbsp; &nbsp; &nbsp;</span><br /><br />&nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span>;<br /><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-30790924239236985862008-03-26T00:52:00.000-07:002008-03-26T01:05:49.510-07:00Учимся достигать целейНаконец-то ты начинаю побеждать себя, практически, во всем. Больше никакой лени и безответственности! Как приятно это ощущать!<br />Ну что ж, теперь могу достигать большего...<br />Первая цель - Atom MX 2.0<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_dnS89WGz6Yg/R-oCRUwWeTI/AAAAAAAAACc/eZ0Jgazo7ZE/s1600-h/atom_mx_black.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_dnS89WGz6Yg/R-oCRUwWeTI/AAAAAAAAACc/eZ0Jgazo7ZE/s320/atom_mx_black.jpg" alt="" id="BLOGGER_PHOTO_ID_5181956817895717170" border="0" /></a> Я люблю экстрим, давно себе хотел нормальный велик. Мне очень понравился этот экстремальный хардтейл с оборудованием любительского класса SRAM 3.0, 21 скорость. Алюминиевая рама Oversize-reinforced 7005. Передний амортизатор Suntour XCR, 120mm, регулируемый. Двойные обода Weinman ZAC2000DW. Тормоза дисковый механический Tectro IO/Promax V.Подходит для активной езды по различным дорогам и пересеченной местности.<br />И цена за этого красавчика просто смешная - чуть больше $300<br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-58402601087487153832008-03-21T00:43:00.000-07:002008-04-11T00:23:37.957-07:00Новый проект :-)С сегодняшнего утра объявил себе войну по поводу утренней зарядки. Все никак не мог начать ее делать постоянно. Поэтому прицепил на дверь напоминание:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_dnS89WGz6Yg/R_8R4ciaZqI/AAAAAAAAACs/RuQtY2RKS7s/s1600-h/%28reflect%29%D0%97%D0%B0%D1%80%D1%8F%D0%B4%D0%BA%D0%BEBETA.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_dnS89WGz6Yg/R_8R4ciaZqI/AAAAAAAAACs/RuQtY2RKS7s/s320/%28reflect%29%D0%97%D0%B0%D1%80%D1%8F%D0%B4%D0%BA%D0%BEBETA.png" alt="" id="BLOGGER_PHOTO_ID_5187884957184976546" border="0" /></a><br /><br /><br />Пока это бета-версия... Но скоро будет stable release!<br />Желаю всем находить силы для борьбы с самим собой это <span style="font-weight: bold;">ОЧЕНЬ ВАЖНО </span>!!!<br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-13202180812414265422008-03-05T02:58:00.000-08:002008-03-05T04:05:07.017-08:00jQuery binding events problemПри использовании ajax запросов и изменении DOM дерева налету не всегда срабатывают функции-обработчики событий для добавленных элементов в документе. Пример:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;"><span style="color: rgb(0, 153, 0); font-style: italic;">// Получаем html код и вставляем его в div</span><br />$<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"#grid_toolbar"</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">load</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"./ajax/toolbar_menu/users.inc"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /><br /><span style="color: rgb(0, 153, 0); font-style: italic;">// Задаем обработчик для нового элемента</span><br />$<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"#delete"</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">click</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span><br /> $<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"#grid"</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">empty</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;<br /><span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(102, 204, 102);">)</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br />Такой способ, к сожалению, не будет работать.<br />В этой ситуации поможет специальный плагин <span style="font-weight: bold;">livequery</span>: <a href="http://docs.jquery.com/Plugins/livequery">http://docs.jquery.com/Plugins/livequery</a><br /><br />Подключаем единственный файл <span style="font-weight: bold;">jquery.livequery.js </span>и переписываем код:<br /><br /><div class="javascript" style="font-family: monospace; color: #000000;"><span style="color: #009900; font-style: italic;">// Загружаем также ;-)</span><br />$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#grid_toolbar&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">load</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;./ajax/toolbar_menu/users.inc&quot;</span><span style="color: #66cc66;">&#41;</span>;<br /><br /><span style="color: #009900; font-style: italic;">// А здесь уже задаем обработчики при помощи livequery</span><br />$<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#delete&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">livequery</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'click'</span>, <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span><br />&nbsp; &nbsp; $<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;#grid&quot;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">empty</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;<br /><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-48239801043167611072008-03-04T04:52:00.000-08:002008-03-05T03:10:08.129-08:00Javascript ошибкиСейчас разруливаю jQuery framework - отличная разработка! Много готовых и расширяемых инструментов. Не мог разобраться с одной ошибкой около часа. В итоге понял, в чем дело... поэтому пишу заметку в блог: если ищешь javascript ошибку больше, чем полчаса - посмотри в <span style="font-weight: bold;">правильном ли порядке ты подключаешь скрипты</span> !!!<br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-58472253346241012502008-02-29T05:11:00.000-08:002008-03-04T05:26:54.359-08:00Тонкая Красная НитьОбалдеть! Чисто случайно наткнулся на альбом этих Харьковских ребят. Теперь уже целую неделю в плейлисте - только они. <span style="font-weight: bold;font-size:24;" >СУПЕР!!!<br /><br /></span><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_dnS89WGz6Yg/R8gFbblGbGI/AAAAAAAAACM/UXohF2kICEQ/s1600-h/tkn.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_dnS89WGz6Yg/R8gFbblGbGI/AAAAAAAAACM/UXohF2kICEQ/s320/tkn.jpg" alt="" id="BLOGGER_PHOTO_ID_5172390140852989026" border="0" /></a>Всем советую!!!<br />Страница вконтакте - <a href="http://vkontakte.ru/club447030">http://vkontakte.ru/club447030</a><br />Сайт группы - <a href="http://www.tkn.com.ua/">www.tkn.com.ua</a><br />И, собственно говоря, альбомчик - <a href="http://www.tkn.com.ua/mp3/tkn-106%28ep%29%282008%29.rar">www.tkn.com.ua/mp3/tkn-106(ep)(2008).rar</a><br /><span style="font-weight: bold;font-size:24;" ><br /><br /></span><br /><br /><script style="font-size: 24px;" src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-83839834330164441152008-02-05T01:03:00.000-08:002008-02-05T01:09:45.311-08:00MySQL и кодировкиИногда при работе с MySQL возникают ошибки, связанные с кодировкой (например, вместо русских символов - знаки вопроса).<br /> Эта проблема решается легко при помощи одного из следующих запросов:<br /><br /><div class="mysql" style="font-family: monospace; color: #000000;">mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'SET NAMES &quot;cp1251&quot;'</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET collation_connection = 'cp1251_general_ci'&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET collation_server = 'cp1251_general_ci'&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET character_set_client='cp1251'&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET character_set_connection='cp1251'&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET character_set_results='cp1251'&quot;</span><span style="color: #66cc66;">&#41;</span>;<br />mysql_query<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;SET character_set_server='cp1251'&quot;</span><span style="color: #66cc66;">&#41;</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-22034736718044721562008-01-10T08:06:00.000-08:002008-04-10T07:36:22.038-07:00Перехват нажатия Enter в IEВот так уж повелось, что IE не дает спокойно жить всем web-developerам. И меня он не устает удивлять.<br /><br />Ситуация следующая: в текстовое поле вводится числовое значение, по нажатию Enter это значение передается на сервер (при помощи AJAX). Что может быть проще? Я привязал функцию обновления на событие <span style="font-weight: bold;">onchange</span> элемента input (текст). Как обычно, все идеально сработало в FireFox и Safari. А этот IE... При нажатии Enter - вообще ничего не происходило.<br /><br /><span style="font-weight: bold;">Объясняю:</span> в IE Enter вызывает событие "onsubmit" формы.<br /><br /><span style="font-weight: bold;">Решение: </span>input должен находиться в форме. На событие onsubmit ставим return false;<br />И добавляем следующий код:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;">processKeyEvent = <span style="color: rgb(0, 51, 102); font-weight: bold;">function</span><span style="color: rgb(102, 204, 102);">(</span>eventType, event<span style="color: rgb(102, 204, 102);">)</span> <br /><span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>window.<span style="color: rgb(0, 102, 0);">event</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> event = window.<span style="color: rgb(0, 102, 0);">event</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> caller_;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>event.<span style="color: rgb(0, 102, 0);">target</span><span style="color: rgb(102, 204, 102);">)</span><br /> caller_ = event.<span style="color: rgb(0, 102, 0);">target</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>event.<span style="color: rgb(0, 102, 0);">srcElement</span><span style="color: rgb(102, 204, 102);">)</span><br /> caller_ = event.<span style="color: rgb(0, 102, 0);">srcElement</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> code;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>event.<span style="color: rgb(0, 102, 0);">keyCode</span><span style="color: rgb(102, 204, 102);">)</span> code = event.<span style="color: rgb(0, 102, 0);">keyCode</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span> <span style="color: rgb(102, 204, 102);">(</span>event.<span style="color: rgb(0, 102, 0);">which</span><span style="color: rgb(102, 204, 102);">)</span> code = event.<span style="color: rgb(0, 102, 0);">which</span>;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">switch</span> <span style="color: rgb(102, 204, 102);">(</span>code<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">case</span> <span style="color: rgb(204, 0, 0);">13</span>:<br /> checkEnteredOrder<span style="color: rgb(102, 204, 102);">(</span>caller_<span style="color: rgb(102, 204, 102);">)</span>; <span style="color: rgb(0, 153, 0); font-style: italic;">// наша функция для обновления</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>; <br /> <span style="color: rgb(102, 204, 102);">}</span> <br /> <span style="color: rgb(102, 204, 102);">}</span>;<br /><br />processKeyPress = <span style="color: rgb(0, 51, 102); font-weight: bold;">function</span><span style="color: rgb(102, 204, 102);">(</span>event<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> processKeyEvent<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"onkeypress"</span>, event<span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span>;<a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br />Затем меняем событие onchange на <span style="font-weight: bold;">keypress:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;">input.<span style="color: rgb(0, 102, 0);">onkeypress</span> = processKeyPress;</div><br /><br /></span>Теперь все проходит через <span><span style="font-weight: bold;">processKeyPress </span><span>хэндлер, а в нем мы отлавливаем нажатую клавишу по <span style="font-weight: bold;">keycode</span>.<br /><br />P.S.: Чувствую, скоро нужно будет создать отдельную категорию на блоге типа "Умри, IE поганый" или "<span style="font-weight: bold;">I</span>nstant <span style="font-weight: bold;">E</span>vil"<br /><br /><br /></span></span><span><span style="font-weight: bold;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_dnS89WGz6Yg/R4ZHVQ4RseI/AAAAAAAAACE/EniK6iofXtw/s1600-h/page23_19.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_dnS89WGz6Yg/R4ZHVQ4RseI/AAAAAAAAACE/EniK6iofXtw/s320/page23_19.jpg" alt="" id="BLOGGER_PHOTO_ID_5153885254205944290" border="0" /></a></span></span><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-89004596998600790192008-01-08T04:15:00.000-08:002008-04-10T07:36:22.039-07:00const + javascript in IEНу вот закончились праздники (ура!), и снова любимая работа...<br /><br /><div style="text-align: center;">Первое удивление в новом году:<br /></div><br />Никогда не используйте ключевое слово <span style="font-weight: bold;font-size:100%;" >const</span> в javascript. Константы не поддерживаются в <span style="font-weight: bold;">IE</span> (в этом только что убедился, посвятив отладке 2 часа). Так что <span style="font-weight: bold;">var</span> вам в помощь ;-)<br /><br /><br /><script style="font-size: 24px;" src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-88081508109007215902007-12-28T23:51:00.000-08:002007-12-29T00:24:35.831-08:00Всех с Новым 2008 Годом !!!<div style="text-align: center;">Удачи Вам, здоровья, всяческих благ и исполнения всех желаний!<br />С Новым Годом !!!<br /></div><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_dnS89WGz6Yg/R3YEFw4RsdI/AAAAAAAAAB8/t6FOH8PlFCU/s1600-h/tree.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_dnS89WGz6Yg/R3YEFw4RsdI/AAAAAAAAAB8/t6FOH8PlFCU/s320/tree.jpg" alt="" id="BLOGGER_PHOTO_ID_5149307721011540434" border="0" /></a><br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-52725507431120859052007-12-21T08:12:00.000-08:002007-12-21T08:50:53.128-08:00Javascript TreeviewВ нашем "вечном" проекте появилась новая задача - реализовать иерархическую структуру категорий. Сделать это нужно было в таблице + реализовать следующие действия:<ul><li>открытие/закрытие ветвей дерева</li><li>перемещение категории на уровень вверх/вниз</li><li>дублирование (как категории отдельно, так и целой ветки)</li><li>удаление элементов</li></ul><br />Немного поразмыслив я придумал такой подход:<br /><br />Каждой строке таблицы присваивается 2 параметра:<br />level - уровень, на котором лежит узел (от 0 и выше)<br />state - состояние узла (open - узел открыт, closed - закрыт, end - узел является конечным )<br /><br /><br />Смотрите скриншот таблицы:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_dnS89WGz6Yg/R2vn-Q4RsZI/AAAAAAAAABc/pnBzX2u4VXA/s1600-h/tree.gif"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_dnS89WGz6Yg/R2vn-Q4RsZI/AAAAAAAAABc/pnBzX2u4VXA/s320/tree.gif" alt="" id="BLOGGER_PHOTO_ID_5146462056069837202" border="0" /></a><br /><br />И так, первая функция для открытия и закрытия узлов. Встречайте:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;"><ol><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> changeRowState<span style="color: rgb(102, 204, 102);">(</span>box, RH_Panel<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"><span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> elem = box.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> current_level = elem.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> current_state = elem.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"state"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> current_table = <span style="color: rgb(51, 102, 204);">"table_body"</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>RH_Panel<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> current_table = <span style="color: rgb(51, 102, 204);">"RH_table_body"</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row_display = <span style="color: rgb(51, 102, 204);">"none"</span>; <span style="color: rgb(0, 153, 0); font-style: italic;">// for style.display</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>current_state == <span style="color: rgb(51, 102, 204);">"closed"</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(0, 153, 0); font-style: italic;">// if item is closed, than show all children</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> row_display = <span style="color: rgb(51, 102, 204);">""</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> tbody = document.<span style="color: rgb(0, 102, 0);">getElementById</span><span style="color: rgb(102, 204, 102);">(</span>current_table<span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> children = tbody.<span style="color: rgb(0, 102, 0);">childNodes</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> after_current = <span style="color: rgb(0, 51, 102); font-weight: bold;">false</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> i=<span style="color: rgb(204, 0, 0);">0</span>; i&lt;children.<span style="color: rgb(0, 102, 0);">length</span>; i++<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span> </div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">tagName</span> == <span style="color: rgb(51, 102, 204);">'TR'</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span> == elem<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> after_current = <span style="color: rgb(0, 51, 102); font-weight: bold;">true</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>after_current<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span> </div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span> != elem<span style="color: rgb(102, 204, 102);">)</span> &amp;&amp; <span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">'level'</span><span style="color: rgb(102, 204, 102);">)</span> == current_level<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>current_state == <span style="color: rgb(51, 102, 204);">"open"</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> elem.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"state"</span>, <span style="color: rgb(51, 102, 204);">"closed"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> box.<span style="color: rgb(0, 102, 0);">src</span> = <span style="color: rgb(51, 102, 204);">"images/branch_closed.gif"</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> elem.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"state"</span>, <span style="color: rgb(51, 102, 204);">"open"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> box.<span style="color: rgb(0, 102, 0);">src</span> = <span style="color: rgb(51, 102, 204);">"images/branch_open.gif"</span>; </div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">return</span>;</div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal;font-family:'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">'level'</span><span style="color: rgb(102, 204, 102);">)</span> &gt; current_level<span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> children<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">style</span>.<span style="color: rgb(0, 102, 0);">display</span> = row_display;</div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> </div><br /></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>current_state == <span style="color: rgb(51, 102, 204);">"open"</span><span style="color: rgb(102, 204, 102);">)</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div style="font-weight: normal; font-family: 'Courier New',Courier,monospace;"> elem.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"state"</span>, <span style="color: rgb(51, 102, 204);">"closed"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> box.<span style="color: rgb(0, 102, 0);">src</span> = <span style="color: rgb(51, 102, 204);">"images/branch_closed.gif"</span>;</div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> <span style="color: rgb(0, 0, 102); font-weight: bold;">else</span></div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> <span style="color: rgb(102, 204, 102);">{</span></div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> elem.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"state"</span>, <span style="color: rgb(51, 102, 204);">"open"</span><span style="color: rgb(102, 204, 102);">)</span>;</div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> box.<span style="color: rgb(0, 102, 0);">src</span> = <span style="color: rgb(51, 102, 204);">"images/branch_open.gif"</span>;</div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"> <span style="color: rgb(102, 204, 102);">}</span></div></li><li style="margin: 0px;"><div face="'Courier New',Courier,monospace" style="font-weight: normal;"><span style="color: rgb(102, 204, 102);">}</span><a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div></li></ol></div><br />Эту функцию мы ставим на событие onclick для элемента &lt;img&gt; в строке таблицы:<br /><br /><div class="html4strict" style="color: rgb(0, 0, 0);font-family:monospace;"><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/tr.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;tr</span></a> level=<span style="color: rgb(255, 0, 0);">"0"</span> state=<span style="color: rgb(255, 0, 0);">"open"</span> <span style="color: rgb(0, 0, 102);">style</span>=<span style="color: rgb(255, 0, 0);">"background:#99ddaa;"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/input.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;input</span></a> <span style="color: rgb(0, 0, 102);">type</span>=<span style="color: rgb(255, 0, 0);">"checkbox"</span> <span style="color: rgb(0, 0, 102);">name</span>=<span style="color: rgb(255, 0, 0);">"tree_items[]"</span> /<span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span><span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span><br /> <span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/a.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;a</span></a> <span style="color: rgb(0, 0, 102);">href</span>=<span style="color: rgb(255, 0, 0);">"javascript:void(0)"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span><br /> <span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/img.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;img</span></a> <span style="color: rgb(0, 0, 102);">src</span>=<span style="color: rgb(255, 0, 0);">"images/branch_open.gif"</span> <span style="color: rgb(0, 0, 102);">onclick</span>=<span style="color: rgb(255, 0, 0);">"changeRowState(this);"</span> /<span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span><br /> <span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/a&gt;</span></span><br /> <span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/a.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;a</span></a> <span style="color: rgb(0, 0, 102);">href</span>=<span style="color: rgb(255, 0, 0);">"action.php"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span><span style="color: rgb(221, 187, 0);">&amp;nbsp;</span><span style="color: rgb(221, 187, 0);">&amp;nbsp;</span><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/b.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;b&gt;</span></a></span>Web Channel (2)<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/b&gt;</span></span><span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/a&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span>56<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span>2<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span>3<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td&gt;</span></a></span>10<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><a style="text-decoration: none;" href="http://december.com/html/4/element/td.html"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;td</span></a> <span style="color: rgb(0, 0, 102);">class</span>=<span style="color: rgb(255, 0, 0);">"statusProduction"</span><span style="color: rgb(0, 0, 0); font-weight: bold;">&gt;</span></span>Published<span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/td&gt;</span></span><br /><span style="color: rgb(0, 153, 0);"><span style="color: rgb(0, 0, 0); font-weight: bold;">&lt;/tr&gt;</span></span><a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br />Логика очень проста: при нажатии на иконку, функция проходит по всем строчкам таблицы и изменяет атрибут display (если уровень больше). При таком подходе, в принципе, уровень вложенности может быть большим. Но для нашего проекта я сделал ограничение до 10 уровней.<br /><br />Функция для изменения уровня узлов:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> changeLevel<span style="color: rgb(102, 204, 102);">(</span>direction<span style="color: rgb(102, 204, 102);">)</span><br /><span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> delta_level = <span style="color: rgb(204, 0, 0);">-1</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>direction == <span style="color: rgb(51, 102, 204);">"down"</span><span style="color: rgb(102, 204, 102);">)</span><br /> delta_level = <span style="color: rgb(204, 0, 0);">1</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> checkboxes = document.<span style="color: rgb(0, 102, 0);">getElementsByName</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"tree_items[]"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> i=<span style="color: rgb(204, 0, 0);">0</span>; i&lt;checkboxes.<span style="color: rgb(0, 102, 0);">length</span>; i++<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">checked</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row = checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> current_level = row.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>current_level != <span style="color: rgb(204, 0, 0);">0</span> || direction == <span style="color: rgb(51, 102, 204);">"down"</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(0, 153, 0); font-style: italic;">// dont move up row with level = 0</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> td = checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">nextSibling</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>td.<span style="color: rgb(0, 102, 0);">nodeType</span> == <span style="color: rgb(204, 0, 0);">3</span><span style="color: rgb(102, 204, 102);">)</span><br /> td = checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">nextSibling</span>.<span style="color: rgb(0, 102, 0);">nextSibling</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> prev_html = td.<span style="color: rgb(0, 102, 0);">innerHTML</span>;<br /> prev_html = prev_html.<span style="color: rgb(0, 102, 0);">slice</span><span style="color: rgb(102, 204, 102);">(</span>prev_html.<span style="color: rgb(0, 102, 0);">indexOf</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"&lt;"</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> new_level = parseInt<span style="color: rgb(102, 204, 102);">(</span>current_level<span style="color: rgb(102, 204, 102);">)</span> + parseInt<span style="color: rgb(102, 204, 102);">(</span>delta_level<span style="color: rgb(102, 204, 102);">)</span>;<br /> td.<span style="color: rgb(0, 102, 0);">innerHTML</span> = getSpacesForLevel<span style="color: rgb(102, 204, 102);">(</span>new_level<span style="color: rgb(102, 204, 102);">)</span> + prev_html;<br /> row.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span>, new_level<span style="color: rgb(102, 204, 102);">)</span>;<br /> row.<span style="color: rgb(0, 102, 0);">style</span>.<span style="color: rgb(0, 102, 0);">backgroundColor</span> = arrColors<span style="color: rgb(102, 204, 102);">[</span>new_level<span style="color: rgb(102, 204, 102);">]</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> tbody = document.<span style="color: rgb(0, 102, 0);">getElementById</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">'table_body'</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> children = tbody.<span style="color: rgb(0, 102, 0);">childNodes</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row_index = getRowIndex<span style="color: rgb(102, 204, 102);">(</span>row<span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>direction == <span style="color: rgb(51, 102, 204);">"down"</span><span style="color: rgb(102, 204, 102);">)</span><br /> row_index++;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> j=row_index; j&lt;children.<span style="color: rgb(0, 102, 0);">length</span>; j++<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">tagName</span> == <span style="color: rgb(51, 102, 204);">'TR'</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span> == current_level<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span> &gt; current_level<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> cur_level = children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> td = children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">childNodes</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 0, 0);">3</span><span style="color: rgb(102, 204, 102);">]</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>td.<span style="color: rgb(0, 102, 0);">innerHTML</span>.<span style="color: rgb(0, 102, 0);">indexOf</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"&lt;img"</span><span style="color: rgb(102, 204, 102);">)</span> == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(0, 153, 0); font-style: italic;">// IE and Safari hack</span><br /> td = children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">childNodes</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 0, 0);">1</span><span style="color: rgb(102, 204, 102);">]</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> prev_html = td.<span style="color: rgb(0, 102, 0);">innerHTML</span>;<br /> prev_html = prev_html.<span style="color: rgb(0, 102, 0);">slice</span><span style="color: rgb(102, 204, 102);">(</span>prev_html.<span style="color: rgb(0, 102, 0);">indexOf</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"&lt;"</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> new_lev = parseInt<span style="color: rgb(102, 204, 102);">(</span>cur_level<span style="color: rgb(102, 204, 102);">)</span> + parseInt<span style="color: rgb(102, 204, 102);">(</span>delta_level<span style="color: rgb(102, 204, 102);">)</span>;<br /> td.<span style="color: rgb(0, 102, 0);">innerHTML</span> = getSpacesForLevel<span style="color: rgb(102, 204, 102);">(</span>new_lev<span style="color: rgb(102, 204, 102);">)</span> + prev_html;<br /> children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">setAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span>, new_lev<span style="color: rgb(102, 204, 102);">)</span>;<br /> children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">style</span>.<span style="color: rgb(0, 102, 0);">backgroundColor</span> = arrColors<span style="color: rgb(102, 204, 102);">[</span>new_lev<span style="color: rgb(102, 204, 102);">]</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(0, 153, 0); font-style: italic;">// for</span><br /> checkAll<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span>; <span style="color: rgb(0, 153, 0); font-style: italic;">// uncheck all checkboxes</span><br /> <span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(0, 153, 0); font-style: italic;">// if</span><br /> <span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(0, 153, 0); font-style: italic;">// if checked</span><br /> <br /><br /> <span style="color: rgb(0, 153, 0); font-style: italic;">// AJAX request to set level</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /><span style="color: rgb(102, 204, 102);">}</span><a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br />А также функции дублирования:<br /><br /><div class="javascript" style="color: rgb(0, 0, 0);font-family:monospace;"><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> duplicateSingle<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span><br /><span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> checkboxes = document.<span style="color: rgb(0, 102, 0);">getElementsByName</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"tree_items[]"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> tbody = document.<span style="color: rgb(0, 102, 0);">getElementById</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"table_body"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> len = checkboxes.<span style="color: rgb(0, 102, 0);">length</span>; <span style="color: rgb(0, 153, 0); font-style: italic;">// FireFox hack (against constant reference to collection of checkboxes)</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> i=<span style="color: rgb(204, 0, 0);">0</span>; i&lt;len; i++<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">checked</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row = checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> inserted_row = tbody.<span style="color: rgb(0, 102, 0);">appendChild</span><span style="color: rgb(102, 204, 102);">(</span>row.<span style="color: rgb(0, 102, 0);">cloneNode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">1</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> td = inserted_row.<span style="color: rgb(0, 102, 0);">childNodes</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 0, 0);">3</span><span style="color: rgb(102, 204, 102);">]</span>;<br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>td.<span style="color: rgb(0, 102, 0);">innerHTML</span>.<span style="color: rgb(0, 102, 0);">indexOf</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"&lt;img"</span><span style="color: rgb(102, 204, 102);">)</span> == <span style="color: rgb(204, 0, 0);">-1</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(0, 153, 0); font-style: italic;">// IE and Safari hack</span><br /> td = inserted_row.<span style="color: rgb(0, 102, 0);">childNodes</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 0, 0);">1</span><span style="color: rgb(102, 204, 102);">]</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> cell_content = td.<span style="color: rgb(0, 102, 0);">innerHTML</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> ins_pos = cell_content.<span style="color: rgb(0, 102, 0);">indexOf</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"&lt;/b&gt;"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> td.<span style="color: rgb(0, 102, 0);">innerHTML</span> = cell_content.<span style="color: rgb(0, 102, 0);">slice</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">0</span>, ins_pos<span style="color: rgb(102, 204, 102);">)</span> + <span style="color: rgb(51, 102, 204);">" Copy"</span> + cell_content.<span style="color: rgb(0, 102, 0);">slice</span><span style="color: rgb(102, 204, 102);">(</span>ins_pos<span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> checkAll<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span>;<br /><span style="color: rgb(102, 204, 102);">}</span><br /><br /><span style="color: rgb(0, 51, 102); font-weight: bold;">function</span> duplicateBranch<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span><br /><span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> checkboxes = document.<span style="color: rgb(0, 102, 0);">getElementsByName</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"tree_items[]"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> tbody = document.<span style="color: rgb(0, 102, 0);">getElementById</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"table_body"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> len = checkboxes.<span style="color: rgb(0, 102, 0);">length</span>; <span style="color: rgb(0, 153, 0); font-style: italic;">// FireFox hack (against constant reference to collection of checkboxes)</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> i=<span style="color: rgb(204, 0, 0);">0</span>; i&lt;len; i++<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">checked</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row = checkboxes<span style="color: rgb(102, 204, 102);">[</span>i<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>.<span style="color: rgb(0, 102, 0);">parentNode</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> inserted_row = tbody.<span style="color: rgb(0, 102, 0);">appendChild</span><span style="color: rgb(102, 204, 102);">(</span>row.<span style="color: rgb(0, 102, 0);">cloneNode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">1</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> current_level = inserted_row.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> tbody = document.<span style="color: rgb(0, 102, 0);">getElementById</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">'table_body'</span><span style="color: rgb(102, 204, 102);">)</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> children = tbody.<span style="color: rgb(0, 102, 0);">childNodes</span>;<br /> <span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> row_index = getRowIndex<span style="color: rgb(102, 204, 102);">(</span>row<span style="color: rgb(102, 204, 102);">)</span>;<br /><br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">for</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 51, 102); font-weight: bold;">var</span> j=<span style="color: rgb(102, 204, 102);">(</span>row_index<span style="color: rgb(204, 0, 0);">+1</span><span style="color: rgb(102, 204, 102);">)</span>; j&lt;children.<span style="color: rgb(0, 102, 0);">length</span>; j++<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">tagName</span> == <span style="color: rgb(51, 102, 204);">'TR'</span><span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span> == current_level<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">break</span>;<br /> <br /> <span style="color: rgb(0, 0, 102); font-weight: bold;">if</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">getAttribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(51, 102, 204);">"level"</span><span style="color: rgb(102, 204, 102);">)</span> &gt; current_level<span style="color: rgb(102, 204, 102);">)</span><br /> <span style="color: rgb(102, 204, 102);">{</span><br /> tbody.<span style="color: rgb(0, 102, 0);">appendChild</span><span style="color: rgb(102, 204, 102);">(</span>children<span style="color: rgb(102, 204, 102);">[</span>j<span style="color: rgb(102, 204, 102);">]</span>.<span style="color: rgb(0, 102, 0);">cloneNode</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">1</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>; <br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> <span style="color: rgb(102, 204, 102);">}</span><br /> checkAll<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(204, 0, 0);">0</span><span style="color: rgb(102, 204, 102);">)</span>;<br /><span style="color: rgb(102, 204, 102);">}</span><a href="http://syhi.stworks.ru/" style="display: block; text-align: right; font-size: 9px;">Syhi-подсветка кода</a></div><br /><br />Кому нужны будут подробные объяснения, или кто сталкивался с подробной задачей - сообщите об этом в комментах.<br /><br />Удачи!<br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-70491463906119823242007-12-18T00:30:00.000-08:002007-12-18T00:33:43.072-08:00Процесс разработкиКак же правдиво все выглядит.<br />Посмотрите на типичний процесс разработки проектов:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_dnS89WGz6Yg/R2eFtg4RsYI/AAAAAAAAABU/zcVQoiF1B1w/s1600-h/process.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_dnS89WGz6Yg/R2eFtg4RsYI/AAAAAAAAABU/zcVQoiF1B1w/s320/process.jpg" alt="" id="BLOGGER_PHOTO_ID_5145228116260663682" border="0" /></a><br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-45391312840757124082007-12-14T06:51:00.000-08:002007-12-14T06:53:37.761-08:00Вот это так письмо!Прислал недавно знакомый, я ржал долго:<br /><br />"Здравствуй, дорогая доченька! Если ты получишь это письмо, значит, оно до тебя дошло. Если же нет, то дай мне знать, и я напишу тебе ещe раз. Я пишу медленно, потому что я знаю, что ты не очень быстро читаешь. Погода у нас хорошая. На прошлой неделе дождь шел всего два раза: в начале недели, 3 дня, и ближе к концу, в течение 4 дней. Кстати, насчет пальтишка, которое ты хотела, дядя Вася сказал, что если пересылать его с этими литыми пуговицами, то это выйдет слишком дорого по весу, поэтому я их отрезала. Пришей их обратно, я положила их в правый кармашек. Твой папа нашeл новую работу. Под ним 500 человек! Он косит траву на кладбище. Твоя сестра Настя недавно вышла замуж, и ждет малыша Мы не знаем, какого он пола, поэтому пока что не могу тебе сказать, будешь ли ты дядей или тeтей. Если это девочка, то она хочет еe назвать, как меня. Немного странное решение, назвать свою дочку Мама. С твоим братом Толей недавно случился казус: он закрыл свою машину, а ключи оставил внутри. Ему пришлось вернуться домой пешком<br />( 10 километров!), чтобы взять второй комплект ключей, и выпустить нас из машины. Если ты вдруг встретишь свою кузину Лилю, то передай ей от меня привет. Eсли ты еe не встретишь, то ничего ей не говори. Твоя мама. P.S.: Я хотела отослать тебе немного денег, но уже заклеила конверт"<br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-868679392800131182007-12-11T01:53:00.000-08:002007-12-11T02:06:02.371-08:00Сервис подсветки кодаОчень часто в постах приходится писать участки кода.<br />Раньше это было полное извращение - менял HTML, сам создавал стили... Недавно узнал об очень удобном сервисе - <b>SyHi</b>(<b>Sy</b>ntax <b>Hi</b>ghlighter for blogs) система подсветки кода для блогов. Такая классная штука!<br /><br />Вот ряд ее достоинств:<br /><br /><ul><li>28 языков для подсветки (PHP, C++, C#, XML и другие)<br /></li><li>нумерация строк</li><li>возможность разрешать/запрещать переносы строк</li></ul>Всем кодерам советую! Адрес: <a href="http://syhi.stworks.ru/"><b>SyHi</b></a><br /><br /><br />А какими сервисами пользуетесь Вы?<br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-13407329954925284632007-12-06T01:23:00.000-08:002007-12-06T02:00:46.592-08:00Удачное продвижениеУра! Проект, который делаю на работе уже начинает внедряться!!! Как же приятно это слышать, а тем более видеть вот такие фотографии (эти ценники создаются при помощи нашего проекта):<br /><br />Великобритания:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_dnS89WGz6Yg/R1fHBMILfoI/AAAAAAAAAAk/Rq87DQSqbZ8/s1600-h/UK.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_dnS89WGz6Yg/R1fHBMILfoI/AAAAAAAAAAk/Rq87DQSqbZ8/s320/UK.JPG" alt="" id="BLOGGER_PHOTO_ID_5140796322916040322" border="0" /></a><br />Китай:<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_dnS89WGz6Yg/R1fHj8ILfpI/AAAAAAAAAAs/2uW9elzEvM4/s1600-h/China.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp3.blogger.com/_dnS89WGz6Yg/R1fHj8ILfpI/AAAAAAAAAAs/2uW9elzEvM4/s320/China.jpg" alt="" id="BLOGGER_PHOTO_ID_5140796919916494482" border="0" /></a><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-19890840190923896932007-12-05T07:16:00.000-08:002007-12-21T06:07:39.588-08:00Какая же ты прелесть ... C# !С прошлой недели потихоньку начинаю переходить на C# - очень классная язык! Я просто балдею от него!<br /><br />Параллельно с изучением в ШАГе решил написать свой проект для раскрутки сайтов.<br />Идея давно всем известна и проста - полуавтоматическая регистрация в поисковиках, каталогах и т.д.<br /><br />Пока делаю основную часть программы. В будущем планирую добавить инструменты для упрощения работы с рекламными программами а также часть инструментов для блоггеров.<br /><br />Все свои результаты выложу здесь, так что следите :-)<br /><br />P.s.: использую Framework 2, у кого нету - можете скачать <a href="http://depositfiles.com/files/2603257">ТУТ</a> (23,5 Мб)<br /><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-7692290927696055352007-11-30T07:13:00.000-08:002007-11-30T07:16:32.752-08:00Горькая правдаИногда смотришь на вот такое, и становится немного грустно:<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp1.blogger.com/_dnS89WGz6Yg/R1ApCCDPCNI/AAAAAAAAAAc/KbXmh96s4oA/s1600-R/teapot.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp1.blogger.com/_dnS89WGz6Yg/R1ApCCDPCNI/AAAAAAAAAAc/XwtMmMG8kzI/s320/teapot.jpg" alt="" id="BLOGGER_PHOTO_ID_5138652289716652242" border="0" /></a><br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>unknownnoreply@blogger.comtag:blogger.com,1999:blog-8421650938130481857.post-88505301523421936922007-11-30T04:56:00.000-08:002008-01-18T00:40:05.179-08:00GUID GeneratorВот на днях понадобилось генерировать GUID. GUID (Globally Unique Identifier) — представляет собой статистически уникальный 128-битный идентификатор. Его главная особенность — уникальность, которая позволяет создавать расширяемые сервисы и приложения без опасения получения конфликтов, вызванных совпадением идентификатора. Хотя уникальность каждого отдельного GUID и не гарантируется, общее количество уникальных ключей настолько велико, что вероятность того, что один и тот же ключ будет получен дважды, крайне мала.<br /><br />GUID — это частная реализация (фирмой Microsoft) стандарта, имеющего название Universally Unique Identifier (UUID).<br /><br />В тексте GUID записывается в виде строки из 16-ричных цифр, разбитых на группы дефисами и окружённой фигурными скобками:<br /><br /> {6F9619FF-8B86-D011-B42D-00CF4FC964FF}<br /><br />Есть куча online сервисов, которые позволяют это сделать, я же предлагаю скачать мой <a href="http://roman-snitko.narod.ru/download/GUID_Generator.rar" style="color: green; font-weight: bold;">GUID Generator</a> (написан на C# Framework v2.0 )<br /><br /><br /><script src="http://odnaknopka.ru/ok3.utf8.js"></script>