mcrypt 或 cryptojs 更好吗?
谁能给我一个例子,我可以如何使用 HML5 加密网络存储?
HTML:
<div id="Data Personal">
<h1>Silakan Masukkan Data</h1>
<div>Nama = <span id="nama" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
<div>telepon = <span id="Telepon" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
<div>Email = <span id="email" contenteditable="true" onkeyup="storeMyContact(this.id)"></span></div>
<div>Kartu kredit = <span id="cc" contenteditable="true"onkeyup="storeMyContact(this.id)"></span></div>
</div>
JavaScript:
function storeMyContact(id) {
var nama = document.getElementById('nama').innerHTML;
var Telepon = document.getElementById('Telepon').innerHTML;
var email = document.getElementById('email').innerHTML;
var cc = document.getElementById('cc').innerHTML;
localStorage.setItem('datnama', nama);
localStorage.setItem('dattlp', Telepon);
localStorage.setItem('datemail', email);
localStorage.setItem('datcc', cc);
}