473,545 Members | 2,009 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

creating new elements & adding drag & drop functionalities (with wz_dragdrop.js library)

var c = document.getEle mentById("Panel Tree");
// PanelTree is a <div> element!

var n = document.create Element("div");
n.setAttribute( 'id', 'nu');
n.setAttribute( 'style', 'position:absol ute;left:0px;to p:0px;');

var tmp2 = document.create TextNode('hello ');

n.appendChild(t mp2);
c.appendChild(n );

//Here evrething works, I see the element attached on PanelTree
// but when I add this..

ADD_DHTML("nu") ;
dd.elements.nu. write("new hello");
// "new hello" is written
dd.elements.con trolPan.addChil d(dd.elements.n u);
// it is visible but it doesn't have drag & drop funtionalites!!
//Why??
Maybe wz_dragdrop.js library does not support elements created
dinamically??

My head hurts.. my heart too..

Please help!!

Miko

Dec 2 '05 #1
2 3464
VK

mi*****@gmail.c om wrote:
dd.elements.nu. write("new hello");


What is that? Is your custom write() method?

Otherwise there is only document.write( ) method and it clears the page
and kills the script if used after the page loaded. The only exception
is to write to another iframe / frame.

Dec 2 '05 #2
mi*****@gmail.c om wrote:
var c = document.getEle mentById("Panel Tree");
// PanelTree is a <div> element!

var n = document.create Element("div");
n.setAttribute( 'id', 'nu');
n.setAttribute( 'style', 'position:absol ute;left:0px;to p:0px;');
Do not use setAttribute(), its implementations are buggy.

n.id = 'nu';
if (typeof n.style != "undefined)
{
n.style.positio n = 'absolute';
n.style.left = '0';
n.style.top = '0';
}
var tmp2 = document.create TextNode('hello ');

n.appendChild(t mp2);
c.appendChild(n );

//Here evrething works, I see the element attached on PanelTree
// but when I add this..

ADD_DHTML("nu") ;
dd.elements.nu. write("new hello");
Am I assuming correctly that ADD_DHTML("nu") adds a reference to the element
with ID `nu' to the dd.elements collection? However HTMLDivElement objects
do not have a write() method. Maybe you are assuming that positioned `div'
elements become NN4-only Layer objects which have a _document.write ()_
method. (Well, maybe not :))
// "new hello" is written
dd.elements.con trolPan.addChil d(dd.elements.n u);
// it is visible but it doesn't have drag & drop funtionalites!!
//Why??
Maybe wz_dragdrop.js library does not support elements created
dinamically??
Maybe. If you pointed to the library you are using and error messages, it
would have been possible to find that out.

OK, today's my social day: the first Google hit points to
<URL:http://www.walterzorn. de/dragdrop/dragdrop.htm>.
Let's see, there is <URL:http://www.walterzorn. de/scripts/wz_dragdrop.js> :

| function ADD_DHTML(d_o) // layers only!
| {
| d_o = new DDObj(d_o);
| dd.addElt(d_o);
| dd.addProps(d_o );
| dd.mkWzDom();
| }

OK, ADD_DHTML() creates a new DDObj ...

| dd.addElt = function(d_o, d_p)
| {
| dd.elements[d_o.name] =
| dd.elements[d_o.index = dd.elements.len gth] = d_o;
| if(d_p) d_p.copies[d_o.name] = d_p.copies[d_p.copies.leng th] = d_o;
| };

| function DDObj(d_o, d_i)
| {
| this.id = d_o;
| [...]
| this.name = this.id + (d_i || '');
| [...]
| }

.... dd.addElt() adds the object to the `elements' collection. So your

dd.elements.nu. write

refers to

| DDObj.prototype .write = function(d_x, d_o)
| {
| this.text = d_x;
| if(!this.div) return;
| if(dd.n4)
| {
| (d_o = this.div.docume nt).open();
| d_o.write(d_x);
| d_o.close();
| dd.getWH(this);
| }
| else
| {
| this.css.height = 'auto';
| this.div.innerH TML = d_x;
| if(!dd.ie4) dd.recalc();
| // n6.0: recalc twice
| if(dd.ie4 || dd.n6) setTimeout('dd. recalc();', 0);
| }
| };

Now you have to find out which branch in DDObj.prototype .write() is taken.
`dd' refers to a WZDD object:

| function WZDD()
| {
| [...]
| this.n4 = !!(document.lay ers && typeof document.classe s != dd_u);
| [...]
| }
| var dd = new WZDD();

The next step would be to find out what each operand evaluates to in a
boolean expression and then check each statement in the respective branch.
Happy debugging!
My head hurts.. my heart too..


You should see a doctor immediately ;-)
PointedEars
Dec 2 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
3249
by: Ed Sutton | last post by:
I am looking for a WinForms drag and drop example that shows how to implement dragging from a WinForm treeView and dropping on another application. I have drag & drop working from within the treeView. Example Use Cases: 1 - Dragging and dropping a file on an Outlook email message to add a file attachment 2 - Dragging and dropping a...
0
1127
by: Andy | last post by:
Hi all, I'm developing an application which allows a drag and drop of files onto a ListView control. Everything works fine on my Windows XP development computer, but when i move the application to a Windows 2003 Server, the drag & drop no longer functions. The mouse cursor changes to the cursor I specify so i know that the DragEnter...
3
1921
by: Kyle Fitzgerald | last post by:
I've started a web control library project and can build my own controls to add to the toolbox in the .NET environment. The problem I'm having is I want to create a control just like the HTML table where I could drag my control on the page and then drag and drop other controls into the cells of the table. I've tried creating my own and I...
6
3534
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product where the user can run on firefox/mozilla, what would be a good approach. 1. Should I overwrite the javascript code drag-and-drop to make it more...
3
10578
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
5364
by: Sim | last post by:
Hello NG, I try to use drag and drop function between two list views. For this I found following code: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchimpdragdrop.asp It works fine, but I have another problem. I want to create functionality like a Windows Explorer. This means, if I select some...
1
1659
by: Taptu¶ | last post by:
Hi, Is there any way to use D&D functionality with panel ? Ex. I have 2 panels: panel 1 and panel2 I want to drag panel1 over panel2 and change parent value of panel1 after Drop panel1.parent = panel2; Best regards Taptu¶
5
1534
by: murrayatuptowngallery | last post by:
I saw a 2-D (like a joystick) slider widget awhile ago. I thought it was on the dojotoolkit.org Demo page, but no one there acknowledges it (they don't deny it either). I would like to learn how to build one of these to allow two parameters to be adjusted simultaneously but independently with one action. I'm starting to wonder if it's...
1
2536
by: kidelectric | last post by:
The issue I am having is that I would like to be able to drag-and-drop div elements that have rounded corners.* Since these elements will be dynamically created (including background color), I could not use the "standard" rounded corner method of sliced images for the corners (since that would only allow a certain color to match) I tried using...
0
7664
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7921
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7771
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
4958
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3446
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1900
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1023
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
720
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.