Very simple Javascript question - how would I make so when a user clicks a link, some text changes on the page without reloading it?
<script type="text/javascript"> function changetext(text, id) { document.getElementById(id).innerHTML = text; } </script> <span onclick="changetext('newtext', 'myid')">CLICK HERE</span> <span id="myid">A line of text</span> HTML:
James Barcellano has given the correct code for a static change. But if you want the text to be loaded from the database you will have to use AJAX. Reply if you are in need of such code.