- Đoạn mã Javascript sau giúp làm điều này :
function encode(str) {
return str.replace(/&/g,'&').replace(/"/g,'"').replace(/'/g,''').replace(/</g,'<').replace(/>/g,'>')
}
Nhập mã html cần mã hoá :
Kết quả mã hoá :
Kết quả mã hoá :
Không có nhận xét nào:
Đăng nhận xét