Useful JS

function checkBlank(field,id,msg)
{
    var formName = document.forms['/ICARD/icardApplicationNewContext'];
    if(document.getElementById(field) != null)
    {
        if(document.getElementById(field).value =='')
        {
            if(document.getElementById(id.toString()) != null)
            {
                document.getElementById(id.toString()).innerHTML=msg;
            }
        }
        else
        {
            if(document.getElementById(id.toString()) != null)
            {
                document.getElementById(id.toString()).innerHTML="";
            }
        }
    }
}

function checkAlphaWithSpecialCharacters(field,id,msg)
{
    var flag="0";
    var valid=" '-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var fvalue =document.getElementById(field).value;
    for (var i=0; i<fvalue.length; i++)
    {
        temp = "" + fvalue.substring(i,i+1);
        if (valid.indexOf(temp) < 0)
        {
            flag="1";
            break;
        }
    }
    if(flag!="0")
    {
        document.getElementById(id).innerHTML=msg;
    }
    else
    {
        document.getElementById(id).innerHTML="";
    }
}


function checkEmail2(obj) {
    var emailStr=document.getElementById(obj).value;
    var valid = true;
    var emailPat=/^(.+)@(.+)$/
    var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    var validChars="\[^\\s" + specialChars + "\]"
    var quotedUser="(\"[^\"]*\")"
    var atom=validChars + '+'
    var word="(" + atom + "|" + quotedUser + ")"
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    var atIndex = emailStr.lastIndexOf('\@');
    var dotIndex = emailStr.lastIndexOf('.');
    
    if(atIndex == -1 || dotIndex == -1|| (atIndex > dotIndex) ){
        valid = false;
    }

    var matchArray=emailStr.match(emailPat)
    if (matchArray==null)
    {
        valid = false;
    } else
    {

        var user=matchArray[1]
        var domain=matchArray[2]

        // See if "user" is valid
        if (user.match(userPat)==null)
        {
            valid = false;
        }

        // Domain is symbolic name
        var domainArray=domain.match(domainPat)
        if (domainArray==null)
        {
            valid = false
        }
    }

    if (!valid)
    {
          
        //obj.focus();
        return false;
    }
    return true;
}

function validateEmail(field,id,msg){
    var flag="0";

    if((document.getElementById("emailAddress")!=null && document.getElementById("emailAddress").value!='') ) {
        if (document.getElementById(field).value!= ""){
            if (!checkEmail2(field)){
               
                flag="1";
              }
        }
    }
    if(flag=="1"){
        document.getElementById(id.toString()).innerHTML=msg;
    }
    else{
        document.getElementById(id).innerHTML="";
    }
}


function handleMotherMaidenName()
{
    checkBlank('motherMaidenName','err_msg_mot_maid_blank',"Please enter your mother\'s maiden name");
    checkAlphaWithSpecialCharacters('motherMaidenName','err_msg_mot_maid_alpha','Please check your mother\'s name entered. Please enter only alphabetic characters in this field.');
}

function handleNationality()
{
    checkBlank('nationality','nationality_blank',"Please enter your nationality");
    checkAlphaWithSpecialCharacters('nationality','nationality_alpha',"Please check your nationality entered. Please enter only alphabetic characters in this field.");
}

function handleTFN1()
{
    checkBlank('TFN1','TFN1_blank',"Please enter your TFN1");
    checkAlphaWithSpecialCharacters('TFN1','TFN1_alpha','Please check your TFN1 entered. Please enter only alphabetic characters in this field.');
}

function handleTFN2()
{
    checkBlank('TFN2','TFN2_blank',"Please enter your TFN2");
    checkAlphaWithSpecialCharacters('TFN2','TFN2_alpha','Please check your TFN2 entered. Please enter only alphabetic characters in this field.');
}

function handleTFN3()
{
    checkBlank('TFN3','TFN3_blank',"Please enter your TFN3");
    checkAlphaWithSpecialCharacters('TFN3','TFN3_alpha','Please check your TFN3 entered. Please enter only alphabetic characters in this field.');
}


function handleEMAIL()
{
    checkBlank('emailAddress','emailAddress_blank',"Please enter your Email");
    validateEmail('emailAddress',"emailAddress_alpha","Please enter your email address in the following format: user@domain.com");
}

function handleException()
{
    checkBlank('exception','exception_blank',"Please select the exception");
    checkAlphaWithSpecialCharacters('exception','exception_alpha','Please select the exception. Please enter only alphabetic characters in this field.');
}


//validate the Form

function validateField(field){
//alert("4");
    if(field!=null){
    //alert("5");
        if(field.name == "nationality"){
        //alert("6");
                if(field.value ==''){
                    checkBlank('nationality','nationality_blank',"Please enter your nationality");
                    //alert("7");
                    return 1;
                }else{
                    checkAlphaWithSpecialCharacters('nationality','nationality_alpha',"Please check your nationality entered. Please enter only alphabetic characters in this field.");
                    return 2;
                }
        }
        
        if(field.name == "TFN1"){
                if(field.value == ''){
                checkBlank('TFN1','TFN1_blank',"Please enter your TFN1");
                return 1;
                }else{
                checkAlphaWithSpecialCharacters('TFN1','TFN1_alpha','Please check your TFN1 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "TFN2"){
                if(field.value == ''){
                checkBlank('TFN2','TFN2_blank',"Please enter your TFN2");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('TFN2','TFN2_alpha','Please check your TFN2 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "TFN3"){
                if(field.value == ''){
                checkBlank('TFN3','TFN3_blank',"Please enter your TFN3");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('TFN3','TFN3_alpha','Please check your TFN3 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "emailAddress"){
                if(field.value == ''){
                checkBlank('emailAddress','emailAddress_blank',"Please enter your Email");
                return 1;
                }
                else{
                validateEmail('emailAddress',"emailAddress_alpha","Please enter your email address in the following format: user@domain.com");
                return 2;
                }
        }
        
        if(field.name == "exception"){
                if(field.value == ''){
                checkBlank('exception','exception_blank',"Please select the exception");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('exception','exception_alpha','Please select the exception. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
    }
    
}


function validateForm(){
//alert("2");
    var errorCounter = 0;
    //alert("3");
    switch(validateField(document.getElementById('nationality'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    //alert("3");
    switch(validateField(document.getElementById('TFN1'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    //alert("4");
    switch(validateField(document.getElementById('TFN2'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('TFN3'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('emailAddress'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('exception'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    
    if(errorCounter == 0){
        return true;
    }else{
        return false;
    }
}










function submitEntry()
{
//alert("1");
validateForm();

}  




http://bbs.blueidea.com/thread-2889494-1-1.html

http://bbs.blueidea.com/thread-2886507-1-1.html

http://blog.sina.com.cn/s/blog_571f76c50100cng3.html

 




function foo(){
    var aInput = document.getElementsByTagName("input");
    for (var i = 0 ; i < aInput.length ; i++ ){
        if(aInput[i].name == 'isPlusAndOnlineAccount' && aInput[i].checked == true){
            alert(aInput[i].value);
            return true;
        }
    }
    return false;
}



function checkBlank(field,id,msg)
{
    var formName = document.forms['/ICARD/icardApplicationNewContext'];
    if(document.getElementById(field) != null)
    {
        if(document.getElementById(field).value =='')
        {
            if(document.getElementById(id.toString()) != null)
            {
                document.getElementById(id.toString()).innerHTML=msg;
            }
        }
        else
        {
            if(document.getElementById(id.toString()) != null)
            {
                document.getElementById(id.toString()).innerHTML="";
            }
        }
    }
}





function checkAlphaWithSpecialCharacters(field,id,msg)
{
    var flag="0";
    var valid=" '-abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
    var fvalue =document.getElementById(field).value;
    for (var i=0; i<fvalue.length; i++)
    {
        temp = "" + fvalue.substring(i,i+1);
        if (valid.indexOf(temp) < 0)
        {
            flag="1";
            break;
        }
    }
    if(flag!="0")
    {
        document.getElementById(id).innerHTML=msg;
    }
    else
    {
        document.getElementById(id).innerHTML="";
    }
}


function checkEmail2(obj) {
    var emailStr=document.getElementById(obj).value;
    var valid = true;
    var emailPat=/^(.+)@(.+)$/
    var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
    var validChars="\[^\\s" + specialChars + "\]"
    var quotedUser="(\"[^\"]*\")"
    var atom=validChars + '+'
    var word="(" + atom + "|" + quotedUser + ")"
    var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
    var atIndex = emailStr.lastIndexOf('\@');
    var dotIndex = emailStr.lastIndexOf('.');
    
    if(atIndex == -1 || dotIndex == -1|| (atIndex > dotIndex) ){
        valid = false;
    }

    var matchArray=emailStr.match(emailPat)
    if (matchArray==null)
    {
        valid = false;
    } else
    {

        var user=matchArray[1]
        var domain=matchArray[2]

        // See if "user" is valid
        if (user.match(userPat)==null)
        {
            valid = false;
        }

        // Domain is symbolic name
        var domainArray=domain.match(domainPat)
        if (domainArray==null)
        {
            valid = false
        }
    }

    if (!valid)
    {
          
        //obj.focus();
        return false;
    }
    return true;
}

function validateEmail(field,id,msg){
    var flag="0";

    if((document.getElementById("emailAddress")!=null && document.getElementById("emailAddress").value!='') ) {
        if (document.getElementById(field).value!= ""){
            if (!checkEmail2(field)){
               
                flag="1";
              }
        }
    }
    if(flag=="1"){
        document.getElementById(id.toString()).innerHTML=msg;
    }
    else{
        document.getElementById(id).innerHTML="";
    }
}


function handleMotherMaidenName()
{
    checkBlank('motherMaidenName','err_msg_mot_maid_blank',"Please enter your mother\'s maiden name");
    checkAlphaWithSpecialCharacters('motherMaidenName','err_msg_mot_maid_alpha','Please check your mother\'s name entered. Please enter only alphabetic characters in this field.');
}

function handleNationality()
{
    checkBlank('nationality','nationality_blank',"Please enter your nationality");
    checkAlphaWithSpecialCharacters('nationality','nationality_alpha',"Please check your nationality entered. Please enter only alphabetic characters in this field.");
}

function handleTFN1()
{
    checkBlank('TFN1','TFN1_blank',"Please enter your TFN1");
    checkAlphaWithSpecialCharacters('TFN1','TFN1_alpha','Please check your TFN1 entered. Please enter only alphabetic characters in this field.');
}

function handleTFN2()
{
    checkBlank('TFN2','TFN2_blank',"Please enter your TFN2");
    checkAlphaWithSpecialCharacters('TFN2','TFN2_alpha','Please check your TFN2 entered. Please enter only alphabetic characters in this field.');
}

function handleTFN3()
{
    checkBlank('TFN3','TFN3_blank',"Please enter your TFN3");
    checkAlphaWithSpecialCharacters('TFN3','TFN3_alpha','Please check your TFN3 entered. Please enter only alphabetic characters in this field.');
}


function handleEMAIL()
{
    checkBlank('emailAddress','emailAddress_blank',"Please enter your Email");
    validateEmail('emailAddress',"emailAddress_alpha","Please enter your email address in the following format: user@domain.com");
}

function handleException()
{
    checkBlank('exception','exception_blank',"Please select the exception");
    checkAlphaWithSpecialCharacters('exception','exception_alpha','Please select the exception. Please enter only alphabetic characters in this field.');
}


<!--validation for isNonResORClaimExcORNoQuoteExc -->


function handleisNonResORClaimExcORNoQuoteExc()
{
    checkBlank('isNonResORClaimExcORNoQuoteExc','isNonResORClaimExcORNoQuoteExc_blank',"Please select the isNonResORClaimExcORNoQuoteExc");
    //checkAlphaWithSpecialCharacters('isNonResORClaimExcORNoQuoteExc','isNonResORClaimExcORNoQuoteExc_alpha','Please select the isNonResORClaimExcORNoQuoteExc. Please enter only alphabetic characters in this field.');
}




//validate the Form

function validateField(field){
//alert("4");
    if(field!=null){
    //alert("5");
        if(field.name == "nationality"){
        //alert("6");
                if(field.value ==''){
                    checkBlank('nationality','nationality_blank',"Please enter your nationality");
                    //alert("7");
                    return 1;
                }else{
                    checkAlphaWithSpecialCharacters('nationality','nationality_alpha',"Please check your nationality entered. Please enter only alphabetic characters in this field.");
                    return 2;
                }
        }
        
        if(field.name == "TFN1"){
                if(field.value == ''){
                checkBlank('TFN1','TFN1_blank',"Please enter your TFN1");
                return 1;
                }else{
                checkAlphaWithSpecialCharacters('TFN1','TFN1_alpha','Please check your TFN1 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "TFN2"){
                if(field.value == ''){
                checkBlank('TFN2','TFN2_blank',"Please enter your TFN2");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('TFN2','TFN2_alpha','Please check your TFN2 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "TFN3"){
                if(field.value == ''){
                checkBlank('TFN3','TFN3_blank',"Please enter your TFN3");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('TFN3','TFN3_alpha','Please check your TFN3 entered. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == "emailAddress"){
                if(field.value == ''){
                checkBlank('emailAddress','emailAddress_blank',"Please enter your Email");
                return 1;
                }
                else{
                validateEmail('emailAddress',"emailAddress_alpha","Please enter your email address in the following format: user@domain.com");
                return 2;
                }
        }
        /*
        if(field.name == "exception"){
                if(field.value == ''){
                checkBlank('exception','exception_blank',"Please select the exception");
                return 1;
                }
                else{
                checkAlphaWithSpecialCharacters('exception','exception_alpha','Please select the exception. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        */
        if(field.name == "isNonResORClaimExcORNoQuoteExc"){
                if(!(document.getElementById('isNonResORClaimExcORNoQuoteExc').checked)){
                
            checkAlphaWithSpecialCharacters('isNonResORClaimExcORNoQuoteExc','isNonResORClaimExcORNoQuoteExc_alpha','Please select the isNonResORClaimExcORNoQuoteExc.');
                return 1;
                }
                else{
    
                checkAlphaWithSpecialCharacters('isNonResORClaimExcORNoQuoteExc','isNonResORClaimExcORNoQuoteExc_alpha','Please select the isNonResORClaimExcORNoQuoteExc. Please enter only alphabetic characters in this field.');
                return 2;
                }
        }
        
        if(field.name == 'isPlusAndOnlineAccount'){
                alert("kaishixuanle");
                if(foo()){
                alert("choose one ");
                return 1;
                }
                else{
                alert("choose nothing!");
                checkAlphaWithSpecialCharacters('isPlusAndOnlineAccount','isPlusAndOnlineAccount_alpha','Please select the account type.');
                return 2;
                }
        }
        
        
        
    }
    
}


function validateForm(){
//alert("2");
    var errorCounter = 0;
    //alert("3");
    switch(validateField(document.getElementById('nationality'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    //alert("3");
    switch(validateField(document.getElementById('TFN1'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    //alert("4");
    switch(validateField(document.getElementById('TFN2'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('TFN3'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('emailAddress'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('exception'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('isNonResORClaimExcORNoQuoteExc'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    switch(validateField(document.getElementById('isPlusAndOnlineAccount'))){
        case 0:break;
        case 1:errorCounter = errorCounter + 1;break;
        case 2:errorCounter = errorCounter + 1;break;
    }
    //alert(errorCounter);
    if(errorCounter == 0){
        return true;
    }else{
        return false;
    }
}










function submitEntry()
{
//alert("1");
if(document.getElementById('acceptTerms')!=null){
    if(!(document.getElementById("acceptTerms").checked))
    alert("Please indicate you agree with the Terms and Conditions!");
}

if(document.getElementById('agreeEStatement')!=null){
    if(!(document.getElementById("agreeEStatement").checked))
    alert("Please indicate you agree with the Terms and Conditions!");
}

validateForm();

}  

 




</script>




智慧医药系统(smart-medicine)是一款采用SpringBoot架构构建的Java Web应用程序。其界面设计简洁而富有现代感,核心特色在于融合了当前前沿的生成式人工智能技术——具体接入了阿里云的通义千问大型语言模型,以此实现智能医疗咨询功能,从而增强系统的技术先进性与实用价值。该系统主要定位为医学知识查询与辅助学习平台,整体功能结构清晰、易于掌握,既适合编程初学者进行技术学习,也可作为院校课程设计或毕业项目的参考实现。 中医舌诊作为传统医学的重要诊断手段,依据舌象的颜色、形状及苔质等特征来辨析生理状况与病理变化。近年来,随着计算科学的进步,人工智能技术逐步渗透到这一传统领域,形成了跨学科的研究与应用方向。所述的中医舌诊系统正是这一方向的实践产物,它运用AI算法对舌象进行自动化分析。系统以SpringBoot为基础框架,该框架依托Java语言,致力于简化Spring应用程序的初始化与开发流程,其突出优势在于能高效构建独立、可投入生产的应用,尤其契合微服务架构与云原生环境,大幅降低了开发者在配置方面的负担。 系统中整合的通义千问大语言模型属于生成式人工智能范畴,通过海量数据训练获得模拟人类语言的能力,可在限定领域内生成连贯文本,为用户提供近似专业医生的交互式咨询。该技术的引入有助于提升诊断过程的自动化水平与结果一致性。 在设计与体验层面,本系统强调逻辑明晰与操作简便,旨在降低用户的学习门槛,尤其适合中医知识的入门教学。整体交互模式接近百科全书式查询,功能模块精炼聚焦,因而非常适用于教育场景,例如学术项目展示或毕业设计答辩。通过直观的实践界面,使用者能够更深入地理解中医舌诊的理论与方法。 此外,系统界面遵循简约大气的设计原则,兼顾视觉美感与交互流畅性,以提升用户的专注度与使用意愿。结合AI的数据处理能力,系统可实现对舌象特征的快速提取与实时分析,这不仅为传统诊断方法增添了客观量化维度,也拓展了中医知识传播的途径。借助网络平台,该系统能够突破地域限制,使更多用户便捷地获取专业化的中医健康参考,从而推动传统医学在现代社会的应用与普及。 资源来源于网络分享,仅用于学习交流使用,请勿用于商业,如有侵权请联系我删除!
【掺铒光纤放大器(EDFA)模型】掺铒光纤放大器(EDFA)分析模型的模拟研究(Matlab代码实现)内容概要:本文介绍了掺铒光纤放大器(EDFA)分析模型的模拟研究,并提供了基于Matlab的代码实现方案。通过对EDFA的工作原理、增益特性、噪声系数等关键性能指标进行数学建模与仿真分析,帮助研究人员深入理解其在光通信系统中的作用机制。文档还列举了多个相关科研方向的技术支持内容,涵盖智能优化算法、路径规划、无人机应用、通信与信号处理、电力系统管理等多个领域,展示了Matlab在科学研究与工程仿真中的广泛应用能力。此外,文中附带网盘链接,便于获取完整的代码资源与开发工具包。; 适合人群:具备一定光学通信或电子信息背景,熟悉Matlab编程,从事科研或工程仿真的研究生、高校教师及技术研发人员。; 使用场景及目标:①用于光通信系统中EDFA性能的理论分析与仿真验证;②支持科研人员快速构建和测试EDFA模型,提升研究效率;③为教学实验、毕业设计及学术论文复现提供可靠的技术参考与代码基础。; 阅读建议:建议读者结合光通信基础知识,按照文档结构逐步运行并调试Matlab代码,重点关注模型参数设置与仿真结果分析,同时可利用提供的网盘资源拓展学习其他相关课题,深化对系统级仿真的理解。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值