URL = "https://portal.datacare.vn"; linkscript = document.createElement('script'); linkscript.setAttribute('src','https://ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js'); document.head.appendChild(linkscript); linkcss = document.createElement('link'); linkcss.setAttribute('href','https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css'); linkcss.setAttribute('rel','stylesheet'); document.head.appendChild(linkcss); linkscript.setAttribute('src','https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js'); document.head.appendChild(linkscript); s2 = document.createElement('script'); s2.setAttribute('src','https://portal.datacare.vn/alertifyjs/alertify.min.js'); document.head.appendChild(s2); linkcss = document.createElement('link'); linkcss.setAttribute('href','https://portal.datacare.vn/alertifyjs/css/alertify.min.css'); linkcss.setAttribute('rel','stylesheet'); document.head.appendChild(linkcss); g = document.createElement('div'); g.setAttribute("id", "frmdt_89"); g.setAttribute("style","z-index:99;position:fixed"); document.body.appendChild(g); //document.getElementById("getform_89").innerHTML = document.getElementById("frmdt_89").innerHTML = ''; function AddS(fid) { console.log("Add " + fid); $("#myModal_89").find("#__btnRegister").attr("onclick","__reg("+fid+")"); $("#myModal_89").find("#__btnRegister").attr("touchend","__reg("+fid+")"); $("#myModal_89").find("#__btnRegister").attr("id","__btnRegister_"+fid); $("#myModal_89").find("#__txtName").attr("id","__txtName_"+fid); $("#myModal_89").find("#__txtEmail").attr("id","__txtEmail_"+fid); $("#myModal_89").find("#__txtAddress").attr("id","__txtAddress_"+fid); $("#myModal_89").find("#__txtPhone").attr("id","__txtPhone_"+fid); $("#myModal_89").find("#__txtNote").attr("id","__txtNote_"+fid); //$("#__btnRegister_"+fid).attr("onclick", "OpenF("+fid+")" ); } function OpenF(fid){ modal = document.getElementById("myModal_"+fid); modal.style.display = "block"; } setTimeout(function() { AddS(89); }, 2000); function __reg(fid){var formid=fid;var name=$("#__txtName_"+fid).val();var phone=$("#__txtPhone_"+fid).val();var email=$("#__txtEmail_"+fid).val();var mess=$("#__txtMessage_"+fid).val();var str="";if(name==""){str+="-Vui lòng nhập họ tên
"} if(phone==""){str+="-Vui lòng nhập số điện thoại
"} if(email==""){str+="-Vui lòng nhập email
"} if(str!=""){alertify .alert(str, function(){ CloseReg(fid); }).setHeader("Thông báo");}else{$.post("https://portal.datacare.vn/do/reg.aspx",{name:name,phone:phone,email:email,mess:mess,formid:formid},function(data){alert("Đăng ký thành công.");CloseReg(fid);})}} document.getElementById("getform_89").innerHTML += '
'; element = document.getElementById("myModal_89"); element.classList.remove("col-md-6"); element.classList.remove("col-xs-12"); // Get the modal modal_89 = document.getElementById("myModal_89"); // Get the button that opens the modal btn_89 = document.getElementById("myBtn_89"); // Get the element that closes the modal span_89 = document.getElementById("btnClose_89"); // When the user clicks on the button, open the modal btn_89.onclick = function() { console.log("open modal click"); modal_89.style.display = "block"; } // When the user clicks on (x), close the modal span_89.onclick = function() { modal_89.style.display = "none"; } // When the user clicks anywhere outside of the modal, close it window.onclick = function(event) { if (event.target == modal_89) { modal_89.style.display = "none"; } } function CloseReg(id) { $("#myModal_"+id).hide(); }