467,923 Members | 1,142 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,923 developers. It's quick & easy.

swapping divs -- when divs NOT positioned absolutely..

hi,

I need to swap divs.. I know how to do this very well when the divs are
positioned absolutely and thus they are "on top of" each other with
z-index, etc...

but now at work I have to do this w/divs that are not positioned
absolutely, they use two very large js files here for it (swapTabs.js
and prototype.js.. in case they sound familiar to anyone..) and every
time I have a hard time implementing it.. I was wondering if somebody
has a simpler formula to do this..

thank you very much...
Nov 14 '07 #1
  • viewed: 1124
Share:
1 Reply
maya wrote:
hi,

I need to swap divs.. I know how to do this very well when the divs are
positioned absolutely and thus they are "on top of" each other with
z-index, etc...

but now at work I have to do this w/divs that are not positioned
absolutely, they use two very large js files here for it (swapTabs.js
and prototype.js.. in case they sound familiar to anyone..) and every
time I have a hard time implementing it.. I was wondering if somebody
has a simpler formula to do this..

thank you very much...

temp=div1.innerHTML;
div1.innerHTML=div2.innerHTML;
div2.innerHTML=temp;

//or use Elem.cloneNode(), for a purer solution
Mick
Mick
Nov 14 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Richard Barnet | last post: by
16 posts views Thread by Pierre Jelenc | last post: by
4 posts views Thread by Vincent.Piattelli | last post: by
2 posts views Thread by Jakub ŇĀukomski | last post: by
22 posts views Thread by pamelafluente | last post: by
2 posts views Thread by Ben Wall | last post: by
2 posts views Thread by Mike | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.