Hi I'm trying to change background gradually on button click on my web page this is a javascript and html code snippets what am I doing wrong?
var content=document.getElementById('content').style;
var content1 = document.getElementById('content1').style;
var start1;
var start2;
var inti =null;
function changeContent(){
start1 =1;
start2 = 1001;
inti=setInterval('swapContent()',20);
}
function swapContent(){
start1 -=5;
start2 -=5;
content.top = start1 + 'px';
content1.top = start2 + 'px';
}
<body>
<div id="navigation" >
<input type="button" onclick="changeContent()" />
</div>
<div id="content">
</div>
<div id="content1">
</div>
</body>
setIntervalwith a string, and ideally don't call Javascript with HTML attributes...)