Cookies
Hej EksperterJeg har aldrig prøvet at la´ve en Cookies. Problemet kan ses på http://geoguide.dk/hik/hik_forside.htm
Find et JPEG billede frem og prøv at zoome.
Cookien findes ikke siger den.
Her er koderne fra 2 filer en js os en asp, som skal sættes sammen på en eller anden måde
/* ---------------Kode fra js------------------------------------------------------------ */
function saveCookie(Name, value)
{
var exp = new Date()
var oneYearFromNow = exp.getTime() + (365 * 24 * 60 * 60 * 1000)
exp.setTime(oneYearFromNow)
document.cookie = Name + \'=\' + value + \'; expires=\' + exp.toGMTString()
}
/* -------------------------------------------------------------------------------- */
function setCookie(Name, value)
{
var iDag = new Date()
/* tid = iDag.getTime() */
tid = (iDag.getHours()*3600)+(iDag.getMinutes()*60)+(iDag.getSeconds())
if ((tid-Gltid) >3 )
{
document.cookie = Name + \'=\' + value + \';\'
}
Gltid = tid
}
/* -------------------------------------------------------------------------------- */
function getCookie(Name)
{
var search = Name + \"=\"
if (document.cookie.length > 0) // if there are any cookies
{
offset = document.cookie.indexOf(search)
if (offset != -1) // if cookie exists
{
offset += search.length
end = document.cookie.indexOf(\";\", offset) // set index of beginning of value
if (end == -1) // set index of end of cookie value
end = document.cookie.length
return unescape(document.cookie.substring(offset, end))
}
}
}
****************************************************************************************************
/* ---------------Kode fra Gis_xy.js------------------------------------------------------------ */
<% @LANGUAGE = VBScript %>
<%
Option Explicit
Response.Expires = 0
Dim objConn, objRS, strQ, strSog, strZoom
Dim strMslink
Dim strDatabaseType, strConnection, strURL, strASP, LocateString
Dim objFS, objTextS, strOwner, mapWidth, mapHight
Dim Ykoor, Xkoor
%>
<!-- #include file = \"GIS_ID.asp\" -->
<%
strSog = Trim(Request.QueryString(\"sog\"))
strZoom = Trim(Request.QueryString(\"zone\"))
strMslink= Trim(Request.QueryString(\"mslink\"))
Set objConn = Server.CreateObject(\"ADODB.Connection\")
objConn.Open strConnection
Set objRS = Server.CreateObject(\"ADODB.Recordset\")
Set objRS.ActiveConnection = objConn
if (strSog=1) then
strQ = \"select Y,X from ADR where MSLINK=\"&strMslink&\";\"
else
strQ = \"select Y,X from MAT where MSLINK=\"&strMslink&\";\"
end if
objRS.Open strQ
While Not objRS.EOF
Ykoor = objRS(\"Y\")
Xkoor = objRS(\"X\")
objRS.MoveNext
Wend
objRS.close
objConn.close
Set objRS = Nothing
Set objConn = Nothing
Ykoor = Ykoor - (strZoom/2.0)
Xkoor = Xkoor - (strZoom/2.0)
LocateString = Ykoor&\"|\"&Xkoor&\"|\"&strZoom&\"|\"&strZoom
Response.Cookies(\"BSIView\") = LocateString
\' Response.Write \"<BR>LocateString=\"&LocateString&\"<BR>\" & chr(13) & chr(10)
Response.Flush
Response.End
%>