»
EnglishFrenchVietnamese

Print - Change Text by Using innerHTML property - JavaScriptBank.com

Full version: jsB@nk » Link » Change Text by Using innerHTML property
URL: https://www.javascriptbank.com/change-text-by-using-innerhtml-property.html

Change Text by Using innerHTML property © JavaScriptBank.comThis code uses innerHTML property to change the text of some object, in this example is links.

Full version: jsB@nk » Link » Change Text by Using innerHTML property
URL: https://www.javascriptbank.com/change-text-by-using-innerhtml-property.html



JavaScript
<script type="text/javascript"><!--// Created by Samanyolu - http://www.webdeveloper.com/forum/showthread.php?t=153389function fun(obj) {  var el = document.getElementById(obj);  el.innerHTML = 'Thanks! Hoped you enjoyed it!';}//--></script>


HTML
<a id="ExpColLink" href="javascript:fun('ExpColLink');">Click to test</a><br /><a id="ExpColLink2" href="#" onclick="fun('ExpColLink2'); alert('This would have opened another page.');">Click to test</a>