Is it possible to add virtual controls to the DOM tree?
-
I have a composite custom web/server-side component that sends several controls to the client-side. If a user of my component wants to interact with it in their client-side javascript they would need to know the names of the various components that make up my component, which takes away from my component's apparent "whole-ness", if that's a word :) Is there a way for my control to create a virtual control in the DOM with the id that the user gave it when they defined it in the source of the web-page? This way they could use the document.getElementById method or even the
. espression to access it like other items in the form. Currently in javascript I've created a collection to manage my custom controls, but it would be nice if the DOM could manage them for me. Thanks
-
I have a composite custom web/server-side component that sends several controls to the client-side. If a user of my component wants to interact with it in their client-side javascript they would need to know the names of the various components that make up my component, which takes away from my component's apparent "whole-ness", if that's a word :) Is there a way for my control to create a virtual control in the DOM with the id that the user gave it when they defined it in the source of the web-page? This way they could use the document.getElementById method or even the
. espression to access it like other items in the form. Currently in javascript I've created a collection to manage my custom controls, but it would be nice if the DOM could manage them for me. Thanks
You can create elements using the DOM and Javascript with their own unique ids. However, you have to recreate these elements each time the page is reposted or refreshed to keep your component's holistic experience.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-
You can create elements using the DOM and Javascript with their own unique ids. However, you have to recreate these elements each time the page is reposted or refreshed to keep your component's holistic experience.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
Would these virtual elements be visable? What I'm looking for are non-display elements that my component can update, which to the web-page developer look as it was the actual component. Is that what you're saying can be done when you suggest creating elements in the DOM using Javascript?
-
Would these virtual elements be visable? What I'm looking for are non-display elements that my component can update, which to the web-page developer look as it was the actual component. Is that what you're saying can be done when you suggest creating elements in the DOM using Javascript?
I am assuming you are using ASP.NET or something similar where you create the web page dynamically on the web server. The controls you are refering to are just assemblied HTML code that displays in the client's web browser. Another way of dynamically creating HTML via the DOM (DHTML), is creating elements and attributes via Javascript and the DOM. This process is very similar to the way that the XML DOM creates and updates nodes. However, this is a lot of work to create and manage using prewritten and dynamically created Javascript. If you are interested in controling a web page this way Google on DHTML and Javascript.
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-
I am assuming you are using ASP.NET or something similar where you create the web page dynamically on the web server. The controls you are refering to are just assemblied HTML code that displays in the client's web browser. Another way of dynamically creating HTML via the DOM (DHTML), is creating elements and attributes via Javascript and the DOM. This process is very similar to the way that the XML DOM creates and updates nodes. However, this is a lot of work to create and manage using prewritten and dynamically created Javascript. If you are interested in controling a web page this way Google on DHTML and Javascript.
"We make a living by what we get, we make a life by what we give." --Winston Churchill