<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; HTA, JS: Перетаскивание строк в таблице]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=11570</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11570&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «HTA, JS: Перетаскивание строк в таблице».]]></description>
		<lastBuildDate>Thu, 09 Jun 2016 15:33:00 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105034#p105034</link>
			<description><![CDATA[<p>Да, что-то со строками таблиц действительно не получается. Хотя таблица целиком таскается нормально.</p>]]></description>
			<author><![CDATA[null@example.com (Natin)]]></author>
			<pubDate>Thu, 09 Jun 2016 15:33:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105034#p105034</guid>
		</item>
		<item>
			<title><![CDATA[Re: HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=105026#p105026</link>
			<description><![CDATA[<p>Ну, во первых, скрипт работает с DIV-ами. Приспособить его для строк таблицы - работа не из легких.<br />Кроме того, тут весьма активно используются всякие новомодные фишки HTML5 и CSS3, которые движок HTA (IE) поддерживает весьма в ограниченных пределах.</p>]]></description>
			<author><![CDATA[null@example.com (mozers)]]></author>
			<pubDate>Thu, 09 Jun 2016 14:32:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=105026#p105026</guid>
		</item>
		<item>
			<title><![CDATA[Re: HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=104995#p104995</link>
			<description><![CDATA[<p><strong>mozers</strong>, интересно, почему. Может в HTA &quot;не та&quot; система событий мышинных кнопок?</p>]]></description>
			<author><![CDATA[null@example.com (Natin)]]></author>
			<pubDate>Wed, 08 Jun 2016 20:56:07 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=104995#p104995</guid>
		</item>
		<item>
			<title><![CDATA[Re: HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=104994#p104994</link>
			<description><![CDATA[<p>2<strong>Natin</strong><br />Скрипт, конечно, интересный, но в HTA не пашет (требуется сурьезная доработка напильником).</p>]]></description>
			<author><![CDATA[null@example.com (mozers)]]></author>
			<pubDate>Wed, 08 Jun 2016 20:48:52 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=104994#p104994</guid>
		</item>
		<item>
			<title><![CDATA[Re: HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=104607#p104607</link>
			<description><![CDATA[<p>Попробуйте <a href="http://javascript.xn----7sbajzfbacq2eog.xn--p1ai/Drag-and-Drop/between-child-containers.html">скрипт переноса элементов</a>, вроде должен работать для любых элементов.</p>]]></description>
			<author><![CDATA[null@example.com (Natin)]]></author>
			<pubDate>Thu, 02 Jun 2016 14:15:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=104607#p104607</guid>
		</item>
		<item>
			<title><![CDATA[HTA, JS: Перетаскивание строк в таблице]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=103515#p103515</link>
			<description><![CDATA[<p>Поиск по данной теме выкатит тучу примеров на jQuery. Можно подумать что на обычном JS это сделать просто невозможно.<br />А я страх не люблю использовать сторонние библиотеки без острой на то необходимости. Пораскинул тут мозгами - получился вот такой компактный код</p><div class="codebox"><pre><code>&lt;html&gt;
&lt;head&gt;
&lt;hta:application /&gt;
&lt;style type=&quot;text/css&quot;&gt;
	.draggable {background-color:highlight; cursor:s-resize;}
&lt;/style&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
window.resizeTo(300, 600);
var drag_row = null;
var start_idx, current_idx;
function createTable(){
	for (var i = 0; i &lt; 20; i++) {
		var row = idTable.insertRow();
		row.insertCell().innerText = &#039;parameter&#039; + i;
		row.insertCell().innerText = &#039;value = &#039; + i;

		row.onmousedown = dragStart;
		row.onmousemove = dragProcess;
	}

	idTable.attachEvent(&#039;onmouseleave&#039;, dragFinish);
	document.attachEvent(&#039;onmouseup&#039;, dragFinish);
}

function dragStart(){
	if (event.button == 1){
		drag_row = this;
		start_idx = drag_row.rowIndex;
		drag_row.className = &#039;draggable&#039;;
	}
}

function dragProcess(){
	if (drag_row) {
		current_idx = this.rowIndex;
		var table = this.parentNode;
		if (current_idx &lt; start_idx) {
			table.insertBefore(drag_row, table.rows[drag_row.rowIndex-1]);
		} else if (current_idx &gt; start_idx) {
			table.insertBefore(table.rows[drag_row.rowIndex+1], drag_row);
		}
		start_idx = current_idx;
	}
}

function dragFinish(){
	if (drag_row) {
		drag_row.className = &#039;&#039;;
		drag_row = null;
	}
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body onload=&quot;createTable()&quot;&gt;
	&lt;table id=&quot;idTable&quot; border=&quot;1&quot;&gt;&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</code></pre></div><p>Данный текст надо сохранить как файл<span style="color: blue">.hta</span> и запустить.<br />К сожалению, не получилось по-нормальному (через attachEvent) навесить dragStart и dragProcess (this не передается даже через замыкание). Может кто подскажет? Повторюсь: Это HTA-код и предназначен он <span class="bbu">исключительно</span> для IE6-11.</p>]]></description>
			<author><![CDATA[null@example.com (mozers)]]></author>
			<pubDate>Sun, 08 May 2016 18:45:21 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=103515#p103515</guid>
		</item>
	</channel>
</rss>
