EugenePaliev
Programmer
Hi folks!
Need help on object creation & calling it's copies. What I wnat - to create one SPAN object and later insert copies of it into different parts of my document.
Code I use to create SPAN:
[tt]
function newSpan(){
var o=document.createElement("span");
// some attributes set here
o.onclick=function(){Expand(someArguments)}
return o
}
[/tt]
And later make a copy of it like this:
[tt]obj=new newSpan();[/tt]
I feel that I'm doing it not really good, I'm confused that I have to do it with [tt]prototype[/tt]. Do I have to?
Or maybe I'd better use [tt]o.cloneNode()[/tt] for making copies?
Thanks for your replies!
Good Luck!
Need help on object creation & calling it's copies. What I wnat - to create one SPAN object and later insert copies of it into different parts of my document.
Code I use to create SPAN:
[tt]
function newSpan(){
var o=document.createElement("span");
// some attributes set here
o.onclick=function(){Expand(someArguments)}
return o
}
[/tt]
And later make a copy of it like this:
[tt]obj=new newSpan();[/tt]
I feel that I'm doing it not really good, I'm confused that I have to do it with [tt]prototype[/tt]. Do I have to?
Or maybe I'd better use [tt]o.cloneNode()[/tt] for making copies?
Thanks for your replies!
Good Luck!