<!DOCTYPE?html>
<html>
<head?id="abc">
????<meta?charset="UTF-8">
????<title></title>
</head>
<body>
<div?id="div">123</div>
<button?data-text="*****"?id="button">按鈕</button>
</body>
<script?type="text/javascript">
????????var?div?=?document.getElementById('div');
????????document.getElementById('button').onclick?=?function?()?{
????????????var?text?=?this.getAttribute('data-text');
????????????this.setAttribute('data-text',div.innerHTML);
????????????div.innerHTML?=?text;
????????}
</script>
</html>