How to fix: End tag for element "X" which is not open

时间:2016-04-15 15:08:00

标签: javascript html w3c-validation

I was running the W3C validator on the HTML page and I received this error:

  1. Line 116, Column 106: end tag for element "TR" which is not open
  2. Line 116, Column 114: end tag for element "TABLE" which is not open
  3. Line 116, Column 120: end tag for element "DIV" which is not open

The errors are coming on this line:

function showme()
{


    document.getElementById("divToolTip").innerHTML = "<div class='rcornerBox'><table border=1><tr><td/></tr></table></div>";   

}

I add the code of the page

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Referring Provider </title>
<link rel="stylesheet" type="text/css" href="css/toolbar/style.css">
<link type="text/css" href="../edi/ss/ui.all.css" rel="stylesheet">
<link type="text/css" href="../ext/jquery-1.8.17/css/redmond/jquery-ui-1.8.17.custom.css" rel="stylesheet">
<style type="text/css" media="all">
 h1 {
    margin: 0;
    font-size:12px;
    font-family:Arial;
}
.style1 {
    text-align: left;
}
.style2 {
    text-align: center;
}    
td.tableCell {
    font: 8pt Verdana, Arial, sans-serif;
    color: #000000;
    background: #FFFFF;
    padding-left: 2px;
    padding-right: 2px;
}
.small {
    color: #666666;
    display: block;
    font-size:11px;
    font-weight: normal;
    text-align: left;

}
.ui-datepicker{
 font-size:12px;
}
.rcornerBox {
    border-radius: 25px;
    border: 1px solid #666666;
    padding: 20px; 
    width: 400px;
    height: 50px;    
}


</style>
<script type="text/javascript" src="../ext/jquery-1.8.17/js/jquery-1.7.1.min.js"></script>
<script type="text/javascript" src="../ext/jquery-1.8.17/js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="../catalog/xml/edi/AdditionalClaimData/js/Validate.js"></script>

<script type="text/javascript">
var box17ProviderRuleEnabled='0';
var box17ProviderType='0';
$(document).ready(function(){
    if(box17ProviderRuleEnabled==0){
        $('input[name="insaddlbox17ProviderType"]').attr('disabled','disabled');
    }else{
        $('#insaddlbox17ProviderRule').attr('checked',true);
        $('#insaddlbox17ProviderType'+box17ProviderType).prop("checked",true);
    }

    $('#insaddlbox17ProviderRule').change(function(){
        var insaddlbox17Box17=$('#insaddlbox17ProviderRule').is(":checked");
        if(insaddlbox17Box17){
            $('input[name="insaddlbox17ProviderType"]').removeAttr('disabled');
            $('#insaddlbox17ProviderType0').prop("checked",true);
        }else{
            $('input[name="insaddlbox17ProviderType"]').attr('disabled','disabled');
            $('input[name="insaddlbox17ProviderType"]').prop('checked',false);
        }
    });


});



function setProviderType(str) 
{   
     var eleSelName = str.value;
     if(eleSelName == '0') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=0" + ";" ;
     } else if(eleSelName == '1') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=1" + ";" ;
     } else if(eleSelName == '2') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=2" + ";" ;
     } else if(eleSelName == '3') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=3" + ";" ;
     } else if(eleSelName == '4') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=4" + ";" ;
     } else if(eleSelName == '5') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=5" + ";" ;
     } else if(eleSelName == '6') {
         window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name + "=6" + ";" ;
     }

}

function setValue(str)
{
    var eleName = document.getElementById(str.id).checked;  
    if(eleName == true) {
        window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name+ "=1" + ";"
    } else {
        window.parent.document.getElementById("storeName").value = window.parent.document.getElementById("storeName").value + str.name+ "=0" + ";"
    }   
}
function showme()
{


    document.getElementById("divToolTip").innerHTML = "<div class='rcornerBox'><table border=1><tr><td/></tr></table></div>";   

}
</script>
</head>
<body>
    <form name="form1" id="form1" method="post" action="">
        <div class="style1" style="width:100%">     
            <table width="100%" cellspacing="4">
                <tr>
                    <td colspan="2">
                        <fieldset style="width:100%">
                        <legend style="font: 9pt Verdana, Arial, sans-serif;">Referring Provider Setup</legend>                                     
                        <br/>

                        <table> 
                            <tr>
                                <td class="tableCell" style="width:400px;margin-left:0px;">
                                    <input type="checkbox" name="insaddlbox17ProviderRule" id="insaddlbox17ProviderRule" onclick="setValue(this)">
                                <a>Box 17: Enable Referring Provider Rule</a><div id="divToolTip"></div>
                                </td>

                            </tr>                   

                        </table><br/>                                       
                        <fieldset  style="width:98%;margin-left:auto;margin-right:auto;">
                            <legend style="font: 8pt Verdana, Arial, sans-serif;">Box 17: Referring Provider Type</legend>
                            <table>
                                <tr title="Associated referrals 'From Provider' will take precedence as the Claim Ref. Provider ">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType6" value="6" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Appt. Referring Provider</td>
                                </tr>

                                <tr title="If Appt. Ref Provider is blank, the Demographic Ref Prvd will be used in Box 17/Ref. Provider    ">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType4" value="4" onclick="setProviderType(this)"></td>
                                    <td class="tableCell" id="tdAppt">Appt. Referring Provider/Demographics Referring Provider</td>
                                </tr>

                                <tr title="If Appt. Ref Provider is blank & Demographic Ref Provider is blank, Box 17/Ref. Provider will be the Claim Rendering Provider">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType3" value="3" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Appt. Referring Provider/Demographics Referring Provider/Claim Rendering Provider</td>
                                </tr>
                                <tr title="Demographic Ref. Provider will be used in Box 17/Ref.Provider">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType2" value="2" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Demographics Referring Provider</td>
                                </tr>
                                <tr title="Claim Rendering Provider will be used in Box 17/Ref.Provider, Ignores Encounter-level Ref. Provider if one is selected">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType1" value="1" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Demographics Rendering Provider (Ignores Encounter-level Referring Provider if one is selected)</td>
                                </tr>
                                <tr title="Appt. Referring Provider / Claim Rendering Provider will be used in Box 17/Ref.Provider, if Encounter-level Ref. Provider is Blank">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType5" value="5" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Appt. Referring Provider / Claim Rendering Provider (If Encounter-level Ref. Provider is blank, ignore Demographics Ref. Provider)</td>
                                </tr>
                                <tr title="Demographic PCP will be used in Box 17/Ref Provider">
                                    <td class="tableCell"><input type="radio" name="insaddlbox17ProviderType" 
                                        id="insaddlbox17ProviderType0" value="0" onclick="setProviderType(this)"></td>
                                    <td class="tableCell">Demographics PCP</td>
                                </tr>

                            </table>
                        </fieldset>                     
                        <table>

                        </table>
                        <br/>                       
                        </fieldset>     
                    </td>
                </tr>    
            </table>        
        </div>
    </form>
</body>
</html>

What do I have to do to fix the errors?

1 个答案:

答案 0 :(得分:0)

You seem to think that the TD is a self-closing tag. It isn't.

That kind of thing will wreak havoc on the validator (and, incidentally, cause your markup to display incorrectly).

Try this:

 document.getElementById("divToolTip").innerHTML = "<div class='rcornerBox'><table border=1><tr><td></td></tr></table></div>";