TR周围的DIV [英] DIV around TR

查看:93
本文介绍了TR周围的DIV的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我已经下载了剧本
http://www.walterzorn.com/dragdrop/d...p_e.htm#config


用于拖放功能。我试过封闭< div>< / div>周围的标签

< table>这样就可以拖动整个表格了。但是,对于单个行,它不会为b $ b工作。举例说明以下作品:


< html>

< head>

< / head>

< body>

< script type =" text / javascript" src =" wz_dragdrop.js">< / script>


< div id =" name1" style =" position:absolute;">

< table border = 1>

< TR>< TD>你好< / TD> < TD>你好吗< / TD>< / TR>

< TR>< TD> hello3< / TD>< TD>你好3< / TD>< / TR>

< / table>

< / div>


< hr>

< div id =" name2" style =" position:absolute;">

< table id =" name2" border = 1>

< TR>< TD>你好,2< / TD> < TD>你好2< / TD>< / TR>

< / table>

< / div>

< div id = QUOT; NAME3"风格= QUOT;位置:绝对;">你好那里< / div>

< script type =" text / javascript">

<! -


SET_DHTML(" name1"," name2"," name3");


// - >

< /脚本>

< / body>

< / html>


但是以下不起作用:


< html>

< head>

< / head>

<正文>

< script type =" text / javascript" src =" wz_dragdrop.js">< / script>

< table border = 1>

< div id =" name1" style =" position:absolute;">

< TR>< TD>你好< / TD> < TD>你好吗< / TD>< / TR>

< TR>< TD> hello3< / TD>< TD>你好3< / TD>< / TR>

< / div>

< / table>

< hr>

< table id =" name2" border = 1>

< div id =" name2" style =" position:absolute;">

< TR>< TD>你好,2< / TD> < TD>你好2< / TD>< / TR>

< / div>

< / table>


< div id =" name3"风格= QUOT;位置:绝对;">你好那里< / div>

< script type =" text / javascript">

<! -


SET_DHTML(" name1"," name2"," name3");


// - >

< /脚本>

< / body>

< / html>

~

解决方案

嗨汤,


首先,在javascript中你不能移动单个表行。所以

是的,你的第一个例子可行,但不是第二个。你能做什么
做的是在td元素中创建一个div元素:


..

..

< td>

< div id =" name4"> text< / div>

< / td>

..

..


这样的东西。但是,如果你拖动它,它将保持在

元素内。如果你想能够分离那个元素,那么你需要在桌子之外创建div元素。

所以*********** @ yahoo.com 写道:

你好<我已经下载了
的脚本 http ://www.walterzorn.com/dragdrop/d...p_e.htm#config

用于拖放功能。我试过封闭< div>< / div>
< table>周围的标签这样就可以拖动整个表格了。但是,它不适用于单个行。举例说明以下作品:

< html>
< head>
< / head>
< body>
< ; script type =" text / javascript" src =" wz_dragdrop.js">< / script>

< div id =" name1" style =" position:absolute;">
< table border = 1>
< TR>< TD>你好< / TD> < TD>你好吗< / TD>< / TR>
< TR>< TD> hello3< / TD>< TD>你好3< / TD>< / TR>
< / table>
< / div>

< ; hr>
< div id =" name2" style =" position:absolute;">
< table id =" name2" border = 1>
< TR>< TD>你好,2< / TD> < TD>你好2< / TD>< / TR>
< / table>
< / div>
< div id =" name3"风格= QUOT;位置:绝对;">你好那里< / div>
< script type =" text / javascript">
<! -

SET_DHTML(" name1"," name2"," name3");

// - >
< / script>
< / body>
< / html>

但以下不起作用:

< html>
< head>
< / head>
< body>
< script type =" text / javascript" src =" wz_dragdrop.js">< / script>

< table border = 1>
< div id =" name1" style =" position:absolute;">
< TR>< TD>你好< / TD> < TD>你好吗< / TD>< / TR>
< TR>< TD> hello3< / TD>< TD>你好3< / TD>< / TR>
< / div>
< / table>

< ; hr>
< table id =" name2" border = 1>
< div id =" name2" style =" position:absolute;">
< TR>< TD>你好,2< / TD> < TD>你好2< / TD>< / TR>
< / div>
< / table>

< div id =" name3"风格= QUOT;位置:绝对;">你好那里< / div>
< script type =" text / javascript">
<! -

SET_DHTML(" name1"," name2"," name3");

// - >
< / script>
< / body>
< / html>




web.dev写道:

首先,在javascript中你可以'不要移动单个表行。




为什么不呢?


document.onclick = function(){

var row1 = document.getElementById(" one");

row1.parentNode.insertBefore(row1,null);

};


< table>

< tr id =" one">< td> One< / td>< / tr>

< tr id =" two">< td> 2< / td>< / tr>

< tr id =" three">< td> ;三< / td>< / tr>

< / table>


Daniel


<集团kquote> web.dev于2005年6月17日在comp.lang.javascript中写道

首先,在javascript中你不能移动单个表行。




< table id = t>

< tr>< td> World< / td>< / tr> ;

< tr>< td> Hello< / td>< / tr>

< / table>


< script type =''text / javascript''>

var t = document.getElementById(''t'')。firstChild

x = t。 firstChild.cloneNode(true);

t.firstChild.removeNode(false);

t.appendChild(x)

< / script> ;


也许它可以做得更简单?


-

Evertjan。

荷兰。

(用我的电子邮件地址替换所有带点的十字架)


Hi
I''ve downloaded the script at
http://www.walterzorn.com/dragdrop/d...p_e.htm#config

for drag and drop feature. I tried enclosing <div></div> tags around
<table> so that the entire table can be dragged. However, it doesn''t
work for individual rows. To give an example the following works:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>

<div id="name1" style="position:absolute;">
<table border=1>
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</table>
</div>

<hr>
<div id="name2" style="position:absolute;">
<table id="name2" border=1>
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</table>
</div>
<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>

However the following doesn''t work:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>
<table border=1>
<div id="name1" style="position:absolute;">
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</div>
</table>
<hr>
<table id="name2" border=1>
<div id="name2" style="position:absolute;">
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</div>
</table>

<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>
~

解决方案

Hi Soup,

First of all, in javascript you can''t move individual table rows. So
yes, your first example will work, but not the second. What you could
do is make a div element within the td element:

..
..
<td>
<div id = "name4">text</div>
</td>
..
..

Something like that. However, if you drag it, it''ll stay within that
element. If you wanted to be able to separate that element, you''re
gonna need to make the div element outside of the table.

so***********@yahoo.com wrote:

Hi
I''ve downloaded the script at
http://www.walterzorn.com/dragdrop/d...p_e.htm#config

for drag and drop feature. I tried enclosing <div></div> tags around
<table> so that the entire table can be dragged. However, it doesn''t
work for individual rows. To give an example the following works:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>

<div id="name1" style="position:absolute;">
<table border=1>
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</table>
</div>

<hr>
<div id="name2" style="position:absolute;">
<table id="name2" border=1>
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</table>
</div>
<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>

However the following doesn''t work:

<html>
<head>
</head>
<body>
<script type="text/javascript" src="wz_dragdrop.js"></script>
<table border=1>
<div id="name1" style="position:absolute;">
<TR><TD> Hello there </TD> <TD> how are you</TD></TR>
<TR><TD> hello3 </TD><TD>how are you 3</TD></TR>
</div>
</table>
<hr>
<table id="name2" border=1>
<div id="name2" style="position:absolute;">
<TR><TD> Hello there2 </TD> <TD> how are you2</TD></TR>
</div>
</table>

<div id="name3" style="position:absolute;"> hello there </div>
<script type="text/javascript">
<!--

SET_DHTML("name1", "name2", "name3");

//-->
</script>
</body>
</html>
~




web.dev wrote:

First of all, in javascript you can''t move individual table rows.



why not?

document.onclick = function() {
var row1 = document.getElementById("one");
row1.parentNode.insertBefore(row1,null);
};

<table>
<tr id="one"><td>One</td></tr>
<tr id="two"><td>Two</td></tr>
<tr id="three"><td>Three</td></tr>
</table>

Daniel


web.dev wrote on 17 jun 2005 in comp.lang.javascript:

First of all, in javascript you can''t move individual table rows.



<table id=t>
<tr><td>World</td></tr>
<tr><td>Hello</td></tr>
</table>

<script type=''text/javascript''>
var t = document.getElementById(''t'').firstChild
x=t.firstChild.cloneNode(true);
t.firstChild.removeNode(false);
t.appendChild(x)
</script>

Perhaps it can be done even simpler?

--
Evertjan.
The Netherlands.
(Replace all crosses with dots in my emailaddress)


这篇关于TR周围的DIV的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆