dannyvince
Technical User
I'm building a translation website and need to be able to toggle the content of div tags to show how a paragraph looks in each language.
I have used the following code, which works fine:
What i'd like to do is to have a "restore" image which restores the content to what it was in the original div tags.
Any ideas?
I have used the following code, which works fine:
Code:
<script type="text/javascript">
function makeTxt(id,txt){
var obj = document.getElementById(id);
obj.firstChild?obj.firstChild.data=txt:obj.appendChild(document.createTextNode(txt))
}
</script>
<a onclick="makeTxt('id1','text 1 text 1 text 1 text 1 text 1 text 1 text 1 text 1 text 1')"><img src="image.jpg">
<div id="id1">text 2 text 2 text 2 text 2 text 2 text 2 text 2 text 2 text 2 text 2 </div>
What i'd like to do is to have a "restore" image which restores the content to what it was in the original div tags.
Any ideas?