JavaScript code to display text in a defined area upon click

October 2017


I am looking for a JavaScript code that would allow me to display text in a defined area when I click on a link.

The page in question is composed of blocks set via CSS.

In the <head> tag:
function ChangeMessage(message,champ)
    document.getElementById(champ).innerHTML = message;

and in <body> :
<A HREF="page.htm" onMouseOver="ChangeMessage('Texte','ejs_texte')" onMouseOut="ChangeMessage('','ejs_texte')">Lien</A>


To trigger action upon click, you must change the HTML event:
<a href="page.htm" onclick="ChangeMessage('Texte','ejs_texte')" >Lien</a>
Published by aakai1056. Latest update on May 21, 2012 at 09:18 AM by aakai1056.
This document, titled "JavaScript code to display text in a defined area upon click," is available under the Creative Commons license. Any copy, reuse, or modification of the content should be sufficiently credited to CCM (