473,548 Members | 2,716 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to use div object dynamically

hello,

i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

cheers,
raja

Apr 16 '07 #1
3 8694
wrote on 16 apr 2007 in comp.lang.javas cript:
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically
document.getEle mentById('mydiv ').style = 'none';

document.getEle mentById('mydiv ').style = 'block';
like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
If you want to programme like some page [the I do not know] why not look at
that code?
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Apr 16 '07 #2
On Apr 15, 11:31 pm, rajachezh...@gm ail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

some simple example;;; works in ie6,ff2,opera9

----
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<style>
#menuTop,#menuT op ul{cursor:defau lt;list-style-type:circle}
#menuTop .m{list-style-type:square}
#menuTop ul{display:none }
</style>
<script>
function showHide(ev){
ev=ev||window.e vent
var elem=(ev.target ||ev.srcElement ).getElementsBy TagName("UL")[0]
if(!elem)return ;
elem=elem.style ;
elem.display=(e lem.display!='b lock')?'block': 'none'
}
</script>
</head>
<body>

<ul onclick="showHi de(event)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>
----
Apr 17 '07 #3
On Apr 17, 5:38 am, "scripts.contac t" <scripts.cont.. .@gmail.com>
wrote:
On Apr 15, 11:31 pm, rajachezh...@gm ail.com wrote:
hello,
i am new to javascript. i want to use DIV object for expand/collapse
the Tree Dynamically like Microsoft explorerer.MY size of the tree
elements are changeing Dynamically. I need some idea or coding for
this purpose.
Can anybody help me.Thanks in advance.

some simple example;;; works in ie6,ff2,opera9
...

or---

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type" content="text/html;
charset=windows-1250">
<meta name="generator " content="PSPad editor, www.pspad.com">
<title></title>
<style>
#menuTop,#menuT op ul{cursor:defau lt;list-style-type:circle}
#menuTop .m{list-style-type:square}
</style>
<script>
function showHide(elem){
elem=elem.getEl ementsByTagName ("UL")[0]
if(!elem)return ;
elem=elem.style ;
elem.display=(e lem.display!='b lock')?'block': 'none'
}

if(document.cre ateStyleSheet){
var styleSheet=docu ment.createStyl eSheet();
styleSheet.addR ule("#menuTop ul","display:no ne")
}else if(document.cre ateElement){
var styleSheet=docu ment.createElem ent("style")
styleSheet.type ="text/css"
styleSheet.text Content="#menuT op ul{display:none }"
document.getEle mentsByTagName( "head")
[0].appendChild(st yleSheet)
}
</script>
</head>
<body>
<ul onclick="showHi de(event.target ||event.srcElem ent)" id="menuTop">
<li>Menu a</li>
<li>Menu b</li>
<li class="m">Menu c
<ul>
<li>Menu ca</li>
<li class="m">Menu cb
<ul>
<li>Menu cca</li>
<li>Menu ccb</li>
<li>Menu ccc</li>
</ul>
</li>
<li>Menu cd</li>
</ul>
</li>
<li>Menu d</li>
<li class="m">Menu e
<ul>
<li>Menu ea</li>
<li>Menu eb</li>
<li>Menu ev</li>
</ul>
</li>
<li>Menu f</li>
</ul>
</body>
</html>


the document will look good and show all the menus if either
javascript OR css is disabled :)

Apr 17 '07 #4

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

Similar topics

3
5571
by: Roman Gordin | last post by:
Hi, I use SVG for web-GUI, but found some serious restrictions 8-( When I use HTML (dynamically generated from .php), I may use HTTPRequest object to provide dynamically regeneration some part of my HTML (from JavaScript). But can`t dynamically refresh SVG, becouse SVG support only ECMAScript This old ECMAScript specification do not...
1
2743
by: Ron Vecchi | last post by:
I am using the FlashShockWave COM object. in the form design mode I specified the Flash Movie .SWF local path. and it loads correctly. My problem is that if I make changes to the swf file it never is changed in the EXE. It seem to be embedded. I have to remove the object and then add a new object for the changes to take effect.
1
1022
by: Reza Nabi | last post by:
Bakground: I have a webform (LoadCtl.aspx) which loads the user control to a placeholder dynamically based on the ctlName querystring passed in the URL. Webform (LoadCtl.aspx) also passes a variable (targetId) in to the usercontrol (IntergySite.aspx) by calling its setter method. Currently, I am using if-then-else and hardcoded the User...
12
2005
by: Belebele | last post by:
Suppose that a class A depends on class B because an object of class B is passed into A's constructor. See below: class B { ... }; class A { public: A(B const& b); ... };
4
5670
by: marcosnogood | last post by:
Hello, I need to dynamically load an activex object because what object to load is based on certain conditions. Also I need to wait for the object to have initialized before moving on. What I did was having the activex object set a variable and have the javascript spin on that variable (a wait function)... function load() { var...
23
1922
by: digitalorganics | last post by:
How can an object replace itself using its own method? See the following code: class Mixin: def mixin(object, *classes): NewClass = type('Mixin', (object.__class__,) + classes, {}) newobj = NewClass() newobj.__dict__.update(object.__dict__) return newobj
7
2518
by: Ron Goral | last post by:
Hello I am new to creating objects in javascript, so please no flames about my coding style. =) I am trying to create an object that will represent a "div" element as a menu. I have written several methods that are working fine. The problem is if I want to dynamically assign an event handler to the object, the event handler is not called....
10
2556
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess is that it's not destroyed, but I'm not sure. I have the following program: #include<iostream>
9
4978
by: grbgooglefan | last post by:
I am trying to pass a C++ object to Python function. This Python function then calls another C++ function which then uses this C++ object to call methods of that object's class. I tried something like this, but it did not work, gave core dump. class myclass { public: myclass(){}; ~myclass(){};
1
1589
by: =?Utf-8?B?Q2hhcmxlcw==?= | last post by:
I'm running VS2008 & attempting to solve a problem I've encountered while developing some software for our business. Here's the basic idea...I've created a class that represents a file (with members such as file name, file location, and a string containing the files data). Each file object also contains an ArrayList of another custom object...
0
7711
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. ...
1
7467
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
7805
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
6039
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
5085
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
3478
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1932
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
1054
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
755
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.