Hi
i'm trying to do treeview
it's working fine but when some body click on the link1 or link2 when the page open it's bring the same list already open
if possible then the link has file link but at the moment it li options
coding rite here in line 32, 39 or 46
[PHP]
<!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
*{list-style:none;font:12px Tahoma;color:#567;margin:0;}
ul li ul{display:none;margin-left:10px}
ul li.active ul{display:block;}
li{clear:both;float:left;cursor:pointer}
</style>
<script type="text/javascript">
function treeView(event)
{
var target = event.target || window.event.srcElement;
if (target.tagName == 'LI')
{
if (target.className!='active')
{
target.className='active';
}
else
{
target.className='';
}
}
}
</script>
</head>
<body>
<ul onclick="treeView(event)">
<li>link 1
<ul>
<li><a href="dsafa">sublink</a></li>
<li><a href="fdsa23">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 2
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 3
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
</ul>
</body>
</html>
[/PHP]
19 2418 acoder 16,027
Recognized Expert Moderator MVP
when some body click on the link1 or link2 when the page open it's bring the same list already open
Could you explain what you mean here? I'm not sure I quite follow what you're saying.
Thx for kindly reply
well question is i've got three link like
[PHP]Link 1
Link 2
Link 3[/PHP]in javascript somebody click on Link 1 it bring subnode like
[PHP]
Link 1
Link 1-1
Link 1-2
Link 2
Link 3
[/PHP]
iv'e got the code which works fine but when click on Link 1 it's brings the subnode
but i want same time open a file & also open subnode as well
when the file opening it's automaticaly know which node is selected
i've just paste the code above if u just run the script you get know what i want.
thx in advance
acoder 16,027
Recognized Expert Moderator MVP
What file(s) would you like to open? Are you looking to download a file or do you mean opening a page?
Hi
actually i'm working on asp with database connectivity
& search a result from database & opening a new page & but it's gonna check if link 1 clicked then it's automatically open's subnode as well on the same time
is that possible in this coding which is above ?
acoder 16,027
Recognized Expert Moderator MVP
In that case, pass the li id to the page that you're linking to and in your ASP code, if an id is passed, set the li class to active inline. Alternatively, you could use JavaScript, e.g. set/retrieve cookies, but that would show up after page load.
is it the best way to do it in asp or javascript ?
could u plz give me some exapmle ? i'm not quite sure ?
thx
acoder 16,027
Recognized Expert Moderator MVP
That depends on what you're most comfortable with and what suits your needs. Could there be a possibility that a user does not have JavaScript enabled? Do you need instant interactivity? If you decide to go with the ASP approach, ask in the ASP forum. If not, I can give you some tips.
Thx for reply
yes u absoluty right i just wondering if you could sort my programming coz they way you explain me i'm trying 2 do work but giving error could you plz give some time to sort my progrmming out the way you told me ?
look forward to see your reply
Best Regards
Fary
acoder 16,027
Recognized Expert Moderator MVP
What error message do you get? Can you post the code that you've tried?
[PHP]
<!DOCTYPE html PUBLIC "-/W3C/DTD XHTML 1.0 Strict/EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Test</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style type="text/css">
*{list-style:none;font:12px Tahoma;color:#567;margin:0;}
ul li ul{display:none;margin-left:10px}
ul li.active ul{display:block;}
li{clear:both;float:left;cursor:pointer}
</style>
<script type="text/javascript">
function treeView(event)
{
var target = event.target || window.event.srcElement;
if (target.tagName == 'LI')
{
if (target.className!='active')
{
target.className='active';
}
else
{
target.className='';
}
}
}
</script>
</head>
<body>
<ul onclick="treeView(event)">
<li><a herf="open_page_&_subnode.htm">link 1</a>
<ul>
<li><a href="subnode1.htm">sublink1</a></li>
<li><a href="subnode2.htm">sublink2</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 2
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
<li>link 3
<ul>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
<li><a href="#">sublink</a></li>
</ul>
</li>
</ul>
</body>
</html>
[/PHP]
acoder 16,027
Recognized Expert Moderator MVP
"herf" should be "href". What's the error message?
actually i'm just explain things
it's the codeing technique like opening file with subnode nothing else
I WANT OPEN NEW PAGE & SUBNODE ON THE SAME TIME
that's the same code i've upload 1st time
plz try to understand the actual scenario
acoder 16,027
Recognized Expert Moderator MVP
The problem here is that the link will open in the same window, so the tree will not open up. The link will be followed instead. Will the linked page also show the same tree that you want opened?
Thank so much for corporation & reply
Yes you right it's not possible but if to passing values & open subnode with to judge the value ?
is it possible ? any example ?
acoder 16,027
Recognized Expert Moderator MVP
I'm sorry, but I'm not sure what you mean by this:
if to passing values & open subnode with to judge the value ?
Do you mean passing the value in the URL to open the node in the linked page?
YES you almost know what i'm trying to do.
acoder 16,027
Recognized Expert Moderator MVP
OK, what you would need to do is pass some info. in the URL, e.g. "open_page_and_node.asp#link1". Then, either use ASP code to have the li items "block" by default or use JavaScript to open the subnode onload. Call a function onload which checks location.hash. If it's not empty, take the hash value and use it as an id, e.g. "link1". For this to work, you will need to give each list item an ID. Then use document.getElementById() to access the element and set the class to "active".
Alternatively, use cookies whenever a subnode is opened and check for cookies on the next page.
Thanks i'm gonna try this & i've got the idea who this gonna work
one more time thx for your concern
acoder 16,027
Recognized Expert Moderator MVP
No problem. Let us know how you manage.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: imani_technology_spam |
last post by:
We need to present hierarchical data on a web page, the same way the
tree view shows files in Windows Explorer. Here's the catch: that
tree view needs to be bound to a SQL Server database. How...
|
by: Tree menu using XML |
last post by:
I have one XML file that has nodes and sub node and each and every node has
the attribute call visible if its value is true then diplay this node else
don't display thid node, but this condition i...
|
by: Jesper DK |
last post by:
Hi,
I have docked a tree view to the left on a form. When I
start to populate this tree view with nodes, a horizontal
scroll box appears in the bottom of the tree view even
though thee tree...
|
by: Saradhi |
last post by:
Hi All,
Here I am facing a performance problem with the TreeView Node renaming.
I am displaying a hierarchy Data in a treeview in my Windows C# Application.
My tree view represents an...
|
by: Kaye |
last post by:
It seems that when I dynamically resize items in a tree-view control, using TVM_SETITEM and the TVITEMEX iIntegral member, things go awry. The window draws properly, but it seems like the RECTs for...
| |
by: dwok |
last post by:
Does anyone know of a good article that discusses creating a "Tree
View" control in ASP.NET? Or perhaps a Tree View Control that comes
with source code? I have come across a lot of tree controls...
|
by: rinishrk |
last post by:
Hi,
I have a web application that contains subfolders Admin and User with
related webpages inside them. Within the Admin folder I have a page
containing a Tree View Control.I want this tree view...
|
by: gmail |
last post by:
Hi Friends,
Can any body suggest me on this.
I am working on .NET 2005 Frame work 2.0 . I am facing problem using the tree stucture. I created the site map.Now i want use the site map in every...
|
by: BeginingOfLife |
last post by:
i am using a java script to create a tree view in my html page.
i got that script from this link :
http://destroydrop.com/javascripts/tree/
given script is static script creations for tree...
|
by: happy.john1234 |
last post by:
Hi, i have got large xml file which i have to show in tree view
windows form.I tried with loading all those data at once to tree view
but it took a long time to render that tree view.Now i am...
|
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,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
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,...
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |