Dynamic Div Content with just clicking one link/button
I need help here please.
I want to show dynamic content to a div. I already have the code below:
<script type="text/javascript"><!--
function ReplaceContentInContainer(id,content) {
var container = document.getElementById(id);
container.innerHTML = content;
}
//--></script>
<div id="example1div" style="padding:10px; text-align:left;">
<p>Content 1</p>
</div>
<p align="center"><a
href="javascript:ReplaceContentInContainer('example1div','<p>Content
2</p>')">View another</a></p>
What it does is, when click the "View another" it replace the 'Content 1'
to 'Content 2' but what I want here is that, when 'Content 2' is already
shown, I want to click the "View another" link again and replace the div
content again with the new content like 'Content 3'.
Anyone please help me solve this.
Thanks in advance :)
No comments:
Post a Comment