[Solved] Change DIV Image Style with Javascript


I think it’s much better if you use classes for this purpose.

Please, try this solution:

<style>

.img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;    
}

.changesize { 
    max-width: 40%;
    max-height: 40%;
}

</style>

<div id="win" class="img">xyz</div>

<script>
    document.getElementById("win").className = "changesize";
</script>

Hope it helps.

solved Change DIV Image Style with Javascript