Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Object & it's copies creation confused...

Status
Not open for further replies.

EugenePaliev

Programmer
Jul 18, 2001
537
UA
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! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top