Use JavaScript function to make this demo more interactivity