473,387 Members | 1,388 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Dtree node value when selected

I'm new to javascript and i need to solve a simple problem: i need to catch the value of a node of dtree when selected, but i don't know how can i get it (doesn't matter what value ... node id, node name, url, ect. are all good for my purpose). I've tried it in many ways, but it really seems there no way to get it! for example, since the url appears in the status bar, i've written the following line: <body onMouseDown=alert(window.status);> but the result is always the same: an empty message! thank you for your help

p.s. sorry for my bad english
Feb 21 '12 #1
6 4040
Dormilich
8,658 Expert Mod 8TB
found at MDC
Sets the text in the status bar at the bottom of the browser or returns the previously set text.
since you can't set text, there is no return value. besides that, the status bar is increasingly unimportant, if enabled at all.


what is a dtree?
Feb 21 '12 #2
dtree is a very popular tree written in javascript that you can find at the following address:

http://destroydrop.com/javascripts/tree/

it's easy to use ... but i'm not able to use it in a dynamic mode ... for example, I'd like to add a new node to the tree on the fly, but since I'm not able to detect the id or the name or the url of the selected node, i can do nothing!!
(the url appears in the status bar, when you move the mouse over the node)
do you have an idea?
thank you very much for your answer
Feb 22 '12 #3
Dormilich
8,658 Expert Mod 8TB
there is a general problem. when you look at the API, you'll find the following:
add()

Adds a node to the tree.
Can only be called before the tree is drawn.
in other words, there is no possibility to modify the tree after its creation (which is what you want to do)
Feb 22 '12 #4
i know ... but i use a trick ... i add a button at the end of the tree, i click on the button and i open a new page, in this page there are some scripts, i mean some routines ... well, i write some parameters into an input field, then i click submit, and the new node is added to the tree, by saving all into a .htm file (using activex method), then i reload the page ... the problem is, since i'm not able to detect any information about the selected node, since i don't know where to add the new node, i have to set the parameters (node id and parent id) manually, using an input field ... it isn't an elegant way!! at least three steps are required! ... dtree is really very easy to use, you can simply append a node at the end of the file, but if you want that the node appears after node C and not after node E, you need to know the id of node C ... for example, node C id is 2 and the new node is added after a list of 20 nodes, so you simply write "add(20,2,'name','link')" ...
Feb 23 '12 #5
solved!!

this is the code to build the tree ...

Expand|Select|Wrap|Line Numbers
  1. d = new dTree('d');
  2. d.config.target = 'RightSide';
  3.  
  4. d.add(0,-1,'My example tree');
  5. d.add(1,0,'Node 1','Panel.html');
  6. d.add(2,0,'Node 2','#');
  7. ect. ect.
than i've used this function:

Expand|Select|Wrap|Line Numbers
  1. function showFramePage() {
  2.         var pageAddress = parent.RightSide.location.href.split("/") 
  3.         pageAddress = pageAddress [pageAddress.length-1]
  4.         alert(pageAddress);
  5.         }
and a button:

Expand|Select|Wrap|Line Numbers
  1. <input type="button" name="showpage" value="Show page" onclick="showFramePage();">
Mar 13 '12 #6
jc0966
1
Hi,
Seems like you are using frames with dtree, which I also use.
But not my target is a div in the same page.
Can you explain how to target in the same page?

I tried:
d.add(id, pid, "Some Name", "javascript:jsfunc(arg)");

jsfunc(arg) {
document.getElementById("someId").src = arg.src;
(where "arg" is the path to an image file).
This opens a new browser window and displays the picture.
Mar 5 '14 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Josh | last post by:
Is it possible to make a textarea required only if a certain value is selected from a <select>? I am trying to make a textarea named ObjOther required only if the value OT is selected from a...
3
by: keepyourstupidspam | last post by:
Hi, I am using xerces dom C++, I want to change an element value, here is the code I am using but the element in the file is not getting updated. ... ... ... xercesc_2_4::DOMDocument*...
4
by: Dave Brydon | last post by:
Access 2003 I have a combo box in my personnel table, which draws its data from a trade code table; the original field in the code table, is numeric, Long Integer, and formatted with 5 zero's . ...
0
by: Namespace | last post by:
Hi I am having trouble selecting more than one value as selected in a listbox through code. The property "ListSelectionMode.Multiple" is set. There is no problem selecting manually (CTRL +...
1
by: zoneal | last post by:
Hello there, Currently I am working with the project which needs dynamically generated checkboxes and i have generated dynamic checkboxes but i am facing problem with getting the value of...
1
by: Dica | last post by:
hi all first off, i'm not trying to cross post, but couldn't find this newsgroup earlier (got here from a recommendation on microsoft.public.vb, where i originally posted this question). ...
7
by: =?Utf-8?B?aXdkdTE1?= | last post by:
hi, im attempting to create an intellisense type form and have hit a roadblock. I need the form to return (like the ShowDialog method returns the dialog result) the value that was selected when the...
7
by: messagewalker | last post by:
Hi guys, I wanted to know how to set node value using xpath, for example <root> <name></name> </root> what I want is get the node 'name' and set its value to say 'bob', so it will be like...
8
by: =?Utf-8?B?WVhR?= | last post by:
I want to do the multi-language program, save the language text in XML file, but how to read the specified node value? the xml is below, for example, i want to get the value(AAA content) that named...
2
by: vjayis | last post by:
hi i m having a select box with multiple select option in registration form so the user can select more than one option at a time and i got those selected values by declaring the select...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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,...
0
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...

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.