PDA

View Full Version : Method to duplicate content


dieselrecords
05-22-2004, 08:39 PM
I have a breadcrumb system on my site. There will be a lot of content on some of my pages so I want to duplicate the breadcrumb on the bottom and top of the page. Now, is there any way using either Javascript or DHTML maybe that would effectively allow me to simply code the breadcrumb once on a page and have it duplicated on the bottom of the page? I don't have the means to do this byway of PHP or any server side methods. Must be client side.

Willy Duitt
05-25-2004, 03:28 AM
Place the first breadcrumb into a span, div or paragraph and use the id of that element to get its innerHTML and then use document.write or another method to duplicate that wherever you would like.

<span id="breadCrumb"><script>document.write(location.href)</script></span>
<div id="pageContent" style="height:500px">Page Content</div>
<span id="breadDuplicate"><script>document.write(document.getElementById('breadCrumb').innerHTML)</script></span>

dieselrecords
05-25-2004, 04:05 AM
Sorry to be so ignorant but where exactly do I place the text I want duplicated within your code?

agent002
05-25-2004, 08:06 AM
there where it says:
<script>document.write(location.href)</script>
Replace that with your text :)