I know that it can be achieved by getElementById function also, but i want use getElementsByClassName function.
<!DOCTYPE html>
<html>
    <body>
        <h1>Date And Time</h1>
        <button type="button" onclick="document.getElementByClassName('demo').innerHTML=Date()">Click me to display Date and Time.</button>
        <p id="demo"></p>
    </body>
</html> 
I am biggner in Java, So please help me.... thank You
` tag as demo as an id, not as a class.
– Nico May 06 '16 at 12:28