I am trying to change the opacity of div element every time i call function
<div id="dv" style="width:200px; height: 20px; background-color: blueviolet; opacity: 0.5; ">
<script>
function opt(){
var d = document.getElementById("dv").style.opacity;
var a = parseFloat(d);
for(var i=0.5; i == a; i+0.1){
if(i==1){
break;
d = document.getElementById("dv").style.opacity = i;
}
}
}
</script>
<input type="submit" value="submit" onclick="opt()"/>
but it's not working, can somebody help where I am wrong?