Hi - thanks in advance for any help you can give! Here is the code I'm trying to get to work - I'm guessing the problem is that there is no submit of the form or the problem is in the javascript - don't know it that well. It's not getting the value from the hidden fields on the getElementById. I've checked to make sure the database has records and they are being loaded into the hidden fields - no problems there. HTML: <!DOCTYPE html> <!-- #include file = "connectMySQL.asp" --> <body onload="RotateImages(0);"> <form method="post" id="ProductList" name="ProductList"> <% SQL = "SELECT * FROM ads WHERE page='Product'" ctrA=-1 Set rs = SQL_Cn.Execute(sql) arrAds = rs.GetRows ctrA = ubound(arrAds,2) rs.Close Set rs = Nothing if ctrA >= 0 then for y = 0 to ctrA %> <input type="hidden" id="img<%=y%>" value="<%=arrAds(2,y)%>"> <input type="hidden" id="lnk<%=y%>" value="<%=arrAds(8,y)%>"> <% next end if %> <table style="width:100%;border:0px;margin-top:-8px"><Tr> <td style="width:50%"> <img src="Logo.png"> </td> <td style="vertical-align:top;margin: 20px auto;position: relative;width: 50%;"> <% if ctrA >= 0 then %> <a id="imageurl" ><img id="Rotating1" border="0" style="position: absolute;left: 45%;margin-left: -50px;width:350px;height:100px"></img></a> <% end if %> </td></table> <script language="JavaScript"> function RotateImages(Start) { var img0=document.getElementById('img0'); var img1=document.getElementById('img1'); var a = new Array(img1,img0); var c = new Array("url1", "url2", "url3", "url4"); var b = document.getElementById('Rotating1'); var d = document.getElementById('imageurl'); if(Start>=a.length) Start=0; b.src = a[Start]; d.href = c[Start]; window.setTimeout("RotateImages(" + (Start+1) + ")",3000); } //RotateImages(0); </script> So any ideas on how to accomplish this will help! Again, thanks for any help!
At the time the hidden fields are loaded, the values are img0=1-BoxAd.png img1=iform.png but it's not reading that from the getElementById.
Spent all day just to figure out I needed: var img0=document.getElementById('img0').value; I'm a newbie - how do I close this?
I don't think the img0 id is being printed in the first place. Check for null and see if it there is any output. Just alert(document.getElementById('img0')); before you fetch and see what alter shows you.