Dorew - Thích Ngao Du
[Nhờ Vả Về JS] Tạo trả lời tự động bằng JS
#TOP
26.10.2022 - 23:07
Vô Tri
Bài đăng: 67
Thảo luận
Đăng nhập một phát, tha hồ bình luận (^3^)
27.10.2022 - 07:47
trum
Bài đăng: 260

HTML5
  1. <script>
  2. const num2Word2 = function () {
  3. var t = ["không", "một", "hai", "ba", "bốn", "năm", "sáu", "bảy", "tám", "chín"],
  4. r = function (r, n) {
  5. var o = "",
  6. a = Math.floor(r / 10),
  7. e = r % 10;
  8. return a > 1 ? (o = " " + t[a] + " mươi", 1 == e && (o += " mốt")) : 1 == a ? (o = " mười", 1 == e && (o += " một")) : n && e > 0 && (o = " lẻ"), 5 == e && a >= 1 ? o += " lăm" : 4 == e && a >= 1 ? o += " tư" : (e > 1 || 1 == e && 0 == a) && (o += " " + t[e]), o
  9. },
  10. n = function (n, o) {
  11. var a = "",
  12. e = Math.floor(n / 100),
  13. n = n % 100;
  14. return o || e > 0 ? (a = " " + t[e] + " trăm", a += r(n, !0)) : a = r(n, !1), a
  15. },
  16. o = function (t, r) {
  17. var o = "",
  18. a = Math.floor(t / 1e6),
  19. t = t % 1e6;
  20. a > 0 && (o = n(a, r) + " triệu", r = !0);
  21. var e = Math.floor(t / 1e3),
  22. t = t % 1e3;
  23. return e > 0 && (o += n(e, r) + " ngàn", r = !0), t > 0 && (o += n(t, r)), o
  24. };
  25. return {
  26. convert: function (r) {
  27. if (0 == r) return t[0];
  28. var n = "",
  29. a = "";
  30. do ty = r % 1e9, r = Math.floor(r / 1e9), n = r > 0 ? o(ty, !0) + a + n : o(ty, !1) + a + n, a = " tỷ"; while (r > 0);
  31. return n.trim()
  32. }
  33. }
  34. }();
  35.  
  36. function num2Word(num) {
  37. return num2Word2.convert(num);
  38. }
  39.  
  40. alert(num2Word(2004));
  41. </script>

27.10.2022 - 16:36
phuong
Bài đăng: 99
@Vô Tri Bổ sung code của @siêu nhân gao cho giống yêu cầu hơn 42

HTML5
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  7. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  8. </head>
  9. <body>
  10.  
  11.  
  12.  
  13.  
  14.  
  15.  
  16.  
  17. <div class="w3-container w3-margin">
  18.  
  19.  
  20. <div class="w3-card-4">
  21. <div class="w3-container">
  22. <h2>Công cụ đoán năm sinh</h2>
  23. </div>
  24.  
  25. <form id="age" class="w3-container w3-margin w3-padding">
  26. <p><label>Nhập số tuổi:</label>
  27. <p style="font-size: 10px;">Nếu nhập tuổi thì ra năm sinh và nếu nhập năm sinh thì ra tuổi =)) tóm lại, bạn tuổi tôm :v</p>
  28. <input class="w3-input" type="number">
  29. </p>
  30. <button type="submit" class="w3-buton w3-white w3-border-light-grey w3-block">Xem kết quả</button>
  31. </form>
  32. <textarea class="w3-input" id="textbox" style="resize: none;display: none"></textarea>
  33.  
  34. </div>
  35. </div>
  36.  
  37. <script>
  38. const num2Word2 = function () {
  39. var t = ["không", "một", "hai", "ba", "bốn", "năm", "sáu", "bảy", "tám", "chín"],
  40. r = function (r, n) {
  41. var o = "",
  42. a = Math.floor(r / 10),
  43. e = r % 10;
  44. return a > 1 ? (o = " " + t[a] + " mươi", 1 == e && (o += " mốt")) : 1 == a ? (o = " mười", 1 == e && (o += " một")) : n && e > 0 && (o = " lẻ"), 5 == e && a >= 1 ? o += " lăm" : 4 == e && a >= 1 ? o += " tư" : (e > 1 || 1 == e && 0 == a) && (o += " " + t[e]), o
  45. },
  46. n = function (n, o) {
  47. var a = "",
  48. e = Math.floor(n / 100),
  49. n = n % 100;
  50. return o || e > 0 ? (a = " " + t[e] + " trăm", a += r(n, !0)) : a = r(n, !1), a
  51. },
  52. o = function (t, r) {
  53. var o = "",
  54. a = Math.floor(t / 1e6),
  55. t = t % 1e6;
  56. a > 0 && (o = n(a, r) + " triệu", r = !0);
  57. var e = Math.floor(t / 1e3),
  58. t = t % 1e3;
  59. return e > 0 && (o += n(e, r) + " ngàn", r = !0), t > 0 && (o += n(t, r)), o
  60. };
  61. return {
  62. convert: function (r) {
  63. if (0 == r) return t[0];
  64. var n = "",
  65. a = "";
  66. do ty = r % 1e9, r = Math.floor(r / 1e9), n = r > 0 ? o(ty, !0) + a + n : o(ty, !1) + a + n, a = " tỷ"; while (r > 0);
  67. return n.trim()
  68. }
  69. }
  70. }();
  71.  
  72. function num2Word(num) {
  73. return num2Word2.convert(num);
  74. }
  75.  
  76. //alert(num2Word(2004));
  77. const d = new Date();
  78. let year = d.getFullYear();
  79.  
  80.  
  81. var form = $("#age");
  82. $(form).submit(function(){
  83. var age = $('input').val();
  84. age = num2Word(year - age);
  85. $('#textbox').text(age);
  86. $("#textbox").show(550).delay(10000).hide('fade-out');
  87. event.preventDefault();
  88. });
  89. </script>
  90. </body>
  91. </html>


Đề mô :v https://spidersilk.w3spaces.co ... .html
P/s: chỉ bổ sung css và html và jquery để có hiệu ứng đẹp mắt hơn 2

27.10.2022 - 20:33
hoangchan
Bài đăng: 67
Cảm ơn @siêu nhân gao @Phương Cute nhé!. Còn 1 vấn đề này nữa
Mình muốn tạo 1 file js bên dưới (giống của @siêu nhân gao )

HTML5
  1. //BOT
  2. $('#bot_btnCreate1').on('click',() => {
  3. var text = Number($('#bot_txt').val());
  4. if(text == '0') { text = '000';}
  5. else if (text == 'Hi''hello','Hê ly','chào','Nĩ Hạo','xin chào','chào bạn') {text = 'Chào bạn';}
  6.  
  7.  
  8. $('#bot_txt').val(text);
  9. })



Và tạo form ( @Phương Cute) gọi phần js ra thì làm thế nào ạ.

27.10.2022 - 21:00
trum
Bài đăng: 260
@Vô Tri <div id=""> với append js thôi a
27.10.2022 - 22:17
hoangchan
Bài đăng: 67
Đây là ý tưởng tạo mục soi kết quả xổ số mỗi khi bảng kết quả xuất hiện lô câm đầu. Phần Js mình lấy bên trang kết quả rất là dài, mình muốn rút gọn nó nhưng cứ xóa đi 1 đoạn nhỏ là nó không hoạt động được.
@siêu nhân gao @Phương Cute đây là vấn đề của mình ạ

HTML5
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta name="viewport" content="width=device-width, initial-scale=1">
  6. <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
  7. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
  8. </head>
  9. <body>
  10.  
  11.  
  12.  
  13. <script language="JavaScript">document.title = "Công cụ soi lô câm đầu hiệu quả"</script>
  14. <div class="card-header"><b>Công cụ soi lô câm đầu hiệu quả</b> </div></br>
  15. <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
  16. <!--nhập vào-->
  17. <span style="color: red"><b>Nhập đầu câm</b>: </span></br><input maxlength="1" type="text" id="Mainlocamdau_txtDan" style="text-align:center"></br></br>
  18.  
  19. <!--hiển thị-->
  20.  
  21. <table id="Mainlocamdau_Table" style="width:100%;">
  22. <td style="width:20%;"><b><input type="submit" value="Kết quả" id="Mainlocamdau_btnCreate1"></b></td>
  23.  
  24. </table>
  25. <td style="width:100%;"><textarea rows="2" cols="20" id="Mainlocamdau_txtDan1" style="font-size:Large;height:95px;width:99%;"></textarea></td>
  26. <script>
  27. function loaiso(){var list_number_all='00,01,02,03,04,05,06,07,08,09,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99';var idtext=document.getElementById('dnn_ctr460_ViewLOAIDANDB_txtNumber');
  28. var idloaidau=document.getElementById('iddau');var idloaiduoi=document.getElementById('idduoi');var idloaicham=document.getElementById('idcham');var idloaibo=document.getElementById('idbo');var idloaitong=document.getElementById('idtong');var idloaisochuan=document.getElementById('idloaiso');var idthemsochuan=document.getElementById('idthemso');if(idloaidau.value.endsWith(',')){idloaidau.value=idloaidau.value.substring(0,idloaidau.value.length-1);}
  29. if(idloaiduoi.value.endsWith(',')){idloaiduoi.value=idloaiduoi.value.substring(0,idloaiduoi.value.length-1);}
  30. if(idloaibo.value.endsWith(',')){idloaibo.value=idloaibo.value.substring(0,idloaibo.value.length-1);}
  31. if(idloaitong.value.endsWith(',')){idloaitong.value=idloaitong.value.substring(0,idloaitong.value.length-1);}
  32. if(idloaisochuan.value.endsWith(',')){idloaisochuan.value=idloaisochuan.value.substring(0,idloaisochuan.value.length-1);}
  33. if(idloaisochuan.value.startsWith(',')){idloaisochuan.value=idloaisochuan.value.substring(1);}
  34. if(idthemsochuan.value.endsWith(',')){idthemsochuan.value=idthemsochuan.value.substring(0,idthemsochuan.value.length-1);}
  35. var stloai=list_number_all;var arraychuoi=myTrim(stloai).split(',');var arrayloaidau=myTrim(idloaidau.value).split(',');for(var i=0;i<arraychuoi.length;i++){for(var j=0;j<arrayloaidau.length;j++){if(arraychuoi[i][0]==arrayloaidau[j]){stloai=stloai.replace(arraychuoi[i]+',','');stloai=stloai.replace(arraychuoi[i],'');}}}
  36. arraychuoi=myTrim(stloai).split(',');var arrayloaiduoi=myTrim(idloaiduoi.value).split(',');for(var i=0;i<arraychuoi.length;i++){for(var j=0;j<arrayloaiduoi.length;j++){if(arraychuoi[i][1]==arrayloaiduoi[j]){stloai=stloai.replace(arraychuoi[i]+',','');stloai=stloai.replace(arraychuoi[i],'');}}}
  37. arraychuoi=myTrim(stloai).split(',');var arrayloaicham=myTrim(idloaicham.value).split(',');for(var i=0;i<arraychuoi.length;i++){for(var j=0;j<arrayloaicham.length;j++){if(arraychuoi[i][0]==arrayloaicham[j]||arraychuoi[i][1]==arrayloaicham[j]){stloai=stloai.replace(arraychuoi[i]+',','');stloai=stloai.replace(arraychuoi[i],'');}}}
  38. arraychuoi=myTrim(stloai).split(',');var arrayloaitong=myTrim(idloaitong.value).split(',');for(var i=0;i<arraychuoi.length;i++){var tong=sumdigits(arraychuoi[i]);for(var j=0;j<arrayloaitong.length;j++){if(arrayloaitong[j].length>0){if(tong-arrayloaitong[j]==0||tong-arrayloaitong[j]==10){stloai=stloai.replace(arraychuoi[i]+',','');stloai=stloai.replace(arraychuoi[i],'');}}}}
  39. var arrayloaibo=myTrim(idloaibo.value).split(',');for(var i=0;i<arrayloaibo.length;i++){if(myTrim(arrayloaibo[i])!=''&&myTrim(arrayloaibo[i]).length==2){var danbo=BOSO(arrayloaibo[i]);arraychuoi=myTrim(danbo).split(',');for(var j=0;j<arraychuoi.length;j++){if(myTrim(arraychuoi[j])!=''&&myTrim(arraychuoi[j]).length==2){stloai=stloai.replace(arraychuoi[j]+',','');stloai=stloai.replace(arraychuoi[j],'');}}}}
  40. if(myTrim(idloaisochuan.value)!=''){arraychuoi=myTrim(idloaiso.value).split(',');for(var j=0;j<arraychuoi.length;j++){stloai=stloai.replace(arraychuoi[j]+',','');stloai=stloai.replace(arraychuoi[j],'');}}
  41. if(myTrim(idthemsochuan.value)!=''){arraychuoi=myTrim(idthemsochuan.value).split(',');for(var j=0;j<arraychuoi.length;j++){if(myTrim(arraychuoi[j])!=''&&arraychuoi[j].length==2&&stloai.indexOf(arraychuoi[j])<0){stloai=stloai+','+arraychuoi[j];}}}
  42. idtext.value=stloai;return false;}
  43.  
  44.  
  45.  
  46. //Lô câm đầu
  47. $('#Mainlocamdau_btnCreate1').on('click',() => {
  48. var text = Number($('#Mainlocamdau_txtDan').val());
  49. if(text == '0') { text = '26 - 62';}
  50. else if (text == '1') {text = '39 - 93';}
  51. else if (text == '2') {text = '24 - 42';}
  52. else if (text == '3') {text = '36 - 63';}
  53. else if (text == '4') {text = '46 - 64';}
  54. else if (text == '5') {text = '39 - 93';}
  55. else if (text == '6') {text = '01 - 10';}
  56. else if (text == '7') {text = '22 - 77';}
  57. else if (text == '8') {text = '11 - 66';}
  58. else if (text == '9') {text = '04 - 40';}
  59.  
  60.  
  61. $('#Mainlocamdau_txtDan1').val(text);
  62. })
  63.  
  64.  
  65. </script>
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73. </body>
  74. </html>

27.10.2022 - 22:24
hoangchan
Bài đăng: 67
Đoạn else if (text == '1') {text = '39 - 93';} là đầu câm và kết quả mỗi khi xuất hiện trong bảng kết quả xổ số
.ví dụ có câm đầu 1, người dùng chỉ cần nhập số 1, sẽ nhận được kết quả là 39-93
27.10.2022 - 22:27
supertroll
Bài đăng: 20
Bạn ko biết code à? Muốn gọn thì phải viết lại code chứ bạn xoá đi thì chạy kiểu gì?
27.10.2022 - 22:27
supertroll
Bài đăng: 20
Bạn ko biết code à? Muốn gọn thì phải viết lại code chứ bạn xoá đi thì chạy kiểu gì?
27.10.2022 - 22:34
hoangchan
Bài đăng: 67
@supertroll mình không biết code. Thường mình sẽ lấy code về và dựa vào đó để thực hiện ý tưởng của mình
28.10.2022 - 00:13
phuong
Bài đăng: 99
@Vô Tri ý bạn là chatbot giống vậy hả :v https://spidersilk.w3spaces.co ... .html
Chủ đề tương tự
Nhận tải Torrent
Chia sẻ ứng dụng/game hay, tốt Android
Canh gà độc
Topic chia sẻ Website tiện ích, hay, thú vị
Giới thiệu truyện/phim hay
Đối tác - Bạn hữu
2018 - 2023 Dorew
Version V.F 1.0.1