คำตอบที่ได้รับเลือกจากเจ้าของกระทู้
ความคิดเห็นที่ 5
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<label>MD5</label>
<input type="text" id="md5" name="md5" value="e10adc3949ba59abbe56e057f20f883e"><br><br>
<button onclick="decrypt()">ถอดรหัส</button>
<br>ผลลัพธ์
<div id="result"></div>
</body>
<script>
async function decrypt() {
var md5 = document.getElementById("md5").value;
let bodyFormData = new FormData();
bodyFormData.append('hash', md5);
bodyFormData.append('act', 'generate');
let url = "https://cors-anywhere.herokuapp.com/http://www.kzynet.com/tools/md5_decoder/";
const myInit = {
body: bodyFormData,
method: "POST"
};
fetch(url,myInit).then(function (response) {
return response.text();
}).then(function (html) {
let position = html.indexOf("ผลลัพธ์");
let end_position = html.indexOf(" </td>",position+80);
let s_string = html.substring(position +80,end_position);
var result = document.getElementById("result");
result.innerHTML = s_string;
}).catch(function (err) {
console.log("error");
console.warn('Something went wrong.', err);
});
}
</script>
</html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<label>MD5</label>
<input type="text" id="md5" name="md5" value="e10adc3949ba59abbe56e057f20f883e"><br><br>
<button onclick="decrypt()">ถอดรหัส</button>
<br>ผลลัพธ์
<div id="result"></div>
</body>
<script>
async function decrypt() {
var md5 = document.getElementById("md5").value;
let bodyFormData = new FormData();
bodyFormData.append('hash', md5);
bodyFormData.append('act', 'generate');
let url = "https://cors-anywhere.herokuapp.com/http://www.kzynet.com/tools/md5_decoder/";
const myInit = {
body: bodyFormData,
method: "POST"
};
fetch(url,myInit).then(function (response) {
return response.text();
}).then(function (html) {
let position = html.indexOf("ผลลัพธ์");
let end_position = html.indexOf(" </td>",position+80);
let s_string = html.substring(position +80,end_position);
var result = document.getElementById("result");
result.innerHTML = s_string;
}).catch(function (err) {
console.log("error");
console.warn('Something went wrong.', err);
});
}
</script>
</html>
แสดงความคิดเห็น
ใครดึง iframe เว็บเฉพาะส่วนเป็นบ้าง