In this example, we have a generatePassword function that generates a random password of length 16 using the characters in the charset string. The password is displayed in a text box with id="password". The copyPassword function selects the password in the text box and copies it to the clipboard using the document.execCommand("copy") method. The two buttons on the page call these functions when they are clicked.