Search code examples
htmlstylesnoscript

Validation error, noscript error


I want to make the some text appear instead of usual one if ActiveX is turned off

it's work but how to make it pass validation((( stuck

Line 389, Column 25: Element style not allowed as child of element noscript in this context. (Suppressing further errors from this subtree.)

  <style type="text/css">messageJS { display:none; }</style>

Contexts in which element style may be used: If the scoped attribute is absent: where metadata content is expected. If the scoped attribute is absent: in a noscript element that is a child of a head element. If the scoped attribute is present: where flow content is expected, but before any other flow content other than inter-element whitespace, and not as the child of an element whose content model is transparent. Content model for element noscript: When scripting is disabled, in a head element: in any order, zero or more link elements, zero or more style elements, and zero or more meta elements. When scripting is disabled, not in a head element: transparent, but there must be no noscript element descendants. Otherwise: text that conforms to the requirements given in the prose.

CODE--------------

 <noscript>
  <div class="conB" style="margin-left: 3px;"><a class="fancybox" href="accessebility.html"> Accessibility </a></div>
  <style type="text/css">
    #accessButt { display:none; }
  </style>
  </noscript>

  <div id="accessButt">
  <div class="conB" style="margin-left: 3px;"><a class="fancybox" href="#accessebility">Accessibility </a></div>
  </div>

Solution

  • Turn the logic the other way around: hide the element by default and reveal it with JavaScript.

    <style type="text/css">
        #accessButt { display:none; }
    </style>
    
    <noscript>
        <div class="conB" style="margin-left: 3px;"><a class="fancybox" href="accessebility.html"> Accessibility </a></div>
    </noscript>
    
    <div id="accessButt">
    <div class="conB" style="margin-left: 3px;"><a class="fancybox" href="#accessebility">Accessibility </a></div>
    </div>
    
    <script>
        document.getElementById( 'accessButt' ).style.display = 'block';
    </script>