I have a problem.
I'm trying to use asynchronous CSS loading to optimize my graphic elements.
In the <head>
of my html I have several links of .css (example:)
<link id="cs1" rel="stylesheet" href="css/ZooCss.css" media="none" onload="cambiarMedia()"/>
The cambiarMedia()
function is above the links:
<script type="text/javascript">
function cambiarMedia() {
if (document.getElementById("cs1").getAttribute('media') === 'none') {
document.getElementById("cs1").setAttribute('media', 'all');
}
}
</script>
Basically what I want you to do is change the value from meta
to all
.
The problems that I crash with:
cambiarMedia
Visual Studio throws me the following error: 'ASP.default_aspx' does not contain a definition of
cambiarMedia
nor is found any extension methodcambiarMedia
that accepts a first argument of type 'ASP.default_aspx' (missing a directive using or an assembly reference?)
cambiarMedia
function so that it is reusable for all CSS's.
Not to rewrite it for each CSS ID. Can you give me a hand with that please?