var checkInput = function() { // 检查后缀名 txt csv excel // 检查多组学数据 var files = ["upload_pheno", "upload_file_1", "upload_file_2", "upload_file_3"]; for (file_id of files){ var obj = document.getElementById(file_id); var len = obj.files.length; var full_file_name = ""; for (var i = 0; i < len; i++) { full_file_name = obj.files[i].name; // combined.txt } var index =full_file_name.lastIndexOf("."); // 获取文件名后缀的索引 var suffix = full_file_name.substring(index+1, full_file_name.length); // txt if (suffix != "csv" && suffix != "txt" && suffix != "excel"){ window.alert("Please upload a txt, csv or excel file!"); var train_form = document.getElementsByClassName("train_form")[0]; train_form.focus(); return false; } } // window.alert("email") // 检查邮件格式 var email = document.getElementById("email").value; //box var regex = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i; if (!regex.test(email)) { window.alert("Please submit the correct email address"); // document.getElementById("email").enter.focus(); var process_form = document.getElementsByClassName("process_form")[0]; process_form.focus(); return false; } // // window.alert(email) // if (email != ""){ // var regex = /^[\w\-\.]+@[a-z0-9]+(\-[a-z0-9]+)?(\.[a-z0-9]+(\-[a-z0-9]+)?)*\.[a-z]{2,4}$/i; // if (!regex.test(email)) { // window.alert("Please submit the correct email address"); // // document.getElementById("email").enter.focus(); // var process_form = document.getElementsByClassName("process_form")[0]; // process_form.focus(); // return false; // } else { // return true; // } // } return true; } var download_example_1 = function() { const fileUrl = "./example/train_example/jobID_omics_1.txt"; // 文件的实际路径 const fileName = "omics_1_example.txt"; // 下载时保存的文件名 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var download_example_2 = function(){ const fileUrl = "./example/train_example/jobID_omics_2.txt"; // 文件的实际路径 const fileName = "omics_2_example.txt"; // 下载时保存的文件名 cnn模型 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var download_example_3 = function(){ const fileUrl = "./example/train_example/jobID_omics_3.txt"; // 文件的实际路径 const fileName = "omics_3_example.txt"; // 下载时保存的文件名 cnn模型 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM } var download_example = function(){ const fileUrl = "./example/train_example/jobID_pheno.txt"; // 文件的实际路径 const fileName = "pheno_example.txt"; // 下载时保存的文件名 pheno数据 const a = document.createElement("a"); // 创建一个 标签元素 a.href = fileUrl; // 设置下载链接 a.download = fileName; // 设置下载文件名 document.body.appendChild(a); // 将 标签添加到页面 a.click(); // 模拟点击 标签,触发下载 document.body.removeChild(a); // 删除 标签,清理DOM }