Hi,

I'm trying to get the below code working... But it seems to be throwing an error when the function hitcount(fn) is called... Im trying to call an ASP function within Javascript... Can anyone please help with this :

-- Javascript code --
<script LANGUAGE="JavaScript1.2" >
function checkurl(fn)
{

str = "http://webhost.in/PNM/Book/<%=gotorpt%>/" + fn;
if (str.indexOf ("web//") > 0)
{
alert("Please Select a Month!");
}
else
{
str2 = "http://webhost.in/PNM/Book/counter.asp?choserpt=Y&whichyrmth=" + str;

hitcount(fn); -- Error occurs here : Object Expected

self.location.href = str;
}
return;
}

</script>

--ASP function --
<%
function hitcount(fn)
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "..\Hits\hitcounter.mdb" -- Database
conn.Mode = 3

set rs = Server.CreateObject("ADODB.Recordset")


set SQL = "UPDATE Application_counter SET Application_counter.[Counter] = Application_counter.Counter+1 where pdf='"+fn.substring(0,8)+"';"

rs.Open SQL,conn,1,3
document.write(rs(0))
rs.Close()
cn.Close()
end function
%>