PDA

View Full Version : Javascript with ASP error



tufanayd
09-25-2009, 05:59 PM
I am trying to list records from an access database. these records will be listed 2 in a row, ASP part of the codesare working but I couldn't manage to run the code in javascrip side. it keeps giving me an error message saying that Expected ';'
How I can get make it working?



var fcontent=new Array();
begintag='<div>'; //set opening tag, such as font declarations

<%
sayi=-1
do while NOT rs.EOF
sayi=sayi+1
%>

fcontent[<%=sayi%>]='<h1><%=rs("Heading")%></h1><p><%=rs("Content")%><br><div align='right'><a href='<%=rs("link")%>'>Read more</a></div></p> '+
<%
rs.movenext
if not rs.Eof then
%>
' <hr><p><h1><%=rs("Heading")%></h1><p><%=rs("Content")%><br><div align='right'><a href='<%=rs("link")%>'>Read more</a></div></p>';

<%
rs.movenext
end if
loop
%>

closetag='</div>';

jscheuer1
09-26-2009, 02:34 AM
That sounds like an IE error message, one of, if not the most vague error reporting mechanisms in most cases.

The easiest way to debug this kind of situation that I know of (there are others, and it depends to a degree upon personal preference) is to set up the page live. Then view the source code in a browser (my favorite for this is Firefox, with developer tools added) guided by any error(s) reported. This will show what the browser is receiving from the server, so all server side code (if it is executing as expected, as you state) is taken out of the equation. Any javascript errors will then be more easily diagnosed.

If you want more help on this one, post a link to your live page that demonstrates the problem.