<html> <body> <script language="javascript"> function function1(){ var date = new Date(); alert(date.toString()); } </script> <button onclick="function1();">Today's date</button> </body> </html>