you could try:
- onclick="\"document.getElementById('flickr" & DivCount & ").style.display = 'block';\""
-
instead, to refer to the node with standards compliant dom-methods, note: flickr1 must be the id then
kind regards
Hi, so I did try by replacing the "window.flickr" statements with document.getElementById but I'm still encountering trouble..
<script type="text/javascript">
messageObj = new DHTML_modalMessage(); // We only create one object of this class
messageObj.setShadowOffset(5); // Large shadow
function displayMessage(url)
{
messageObj.setSource(url);
messageObj.setCssClassMessageBox(false);
messageObj.setSize(400,400);
messageObj.setShadowDivVisible(true); // Enable shadow for these boxes
messageObj.display();
}
function displayStaticMessage(messageContent,cssClass)
{
messageObj.setHtmlContent(messageContent);
messageObj.setSize(400,400);
messageObj.setCssClassMessageBox(cssClass);
messageObj.setSource(false); // no html source since we want to use a static message here.
messageObj.setShadowDivVisible(false); // Disable shadow for these boxes
messageObj.display();
}
function closeMessage()
{
messageObj.close();
}
</script>
<%
isFirecrest = NULL
strIPAddress = request.servervariables("REMOTE_ADDR")
Call fn_CheckNetwork(strIPAddress,isFirecrest)
'################################################# #############################################
'URL of your RSS feed (copy from the "Feed" link of your Flickr gallery
'################################################# #############################################
Dim strXMLURL
strXMLURL = "http://api.flickr.com/services/feeds/photos_public.gne?id=16512192@N08&lang=en-us&format=rss_200"
'#################################################
'The name of the file to which the HTML is cached
'#################################################
Dim strCacheHTML
strCacheHTML = "flickr.asp"
'################################################# ###########
'The local path to the folder you will cache photos to, e.g.
'################################################# ###########
Dim strCachePath
strCachePath = "\\www1\serverone\www\nanet.britainusa.com\images\ flickrfeed\"
'#################################################
'The public URL to the above cache directory, e.g.
'#################################################
Dim strCacheURL
if isFirecrest then
strCacheURL = "https://nanet.britainusa.com/images/flickrfeed/"
else
strCacheURL = "http://nanet.britainusa.com/images/flickrfeed/"
End if
'################################################# #############################################
'This function takes the URL of the RSS feed, and the XML node name of each photo
'################################################# #############################################
Function getXMLNode(strURL, strNode)
Dim objXML
Set objXML = Server.CreateObject("MSXML2.FreeThreadedDOMDocumen t")
objXML.Async = False
objXML.setProperty "ServerHTTPRequest", True
objXML.Load(strURL)
'################################################# ###
'Returns a collection of nodes to be looped through
'################################################# ###
Set getXMLNode = objXML.getElementsByTagName(strNode)
Set objXML = Nothing
End Function
Function cacheFileIsExpired(strFileName, cacheInterval, cacheIntervalUnit)
If cacheInterval = 0 Then
cacheFileIsExpired = True
Exit Function
End If
On Error Resume Next
Dim cacheFSO
Set cacheFSO = CreateObject("Scripting.FileSystemObject")
Dim cacheFile
Set cacheFile = cacheFSO.GetFile(strCachePath & strFileName)
Dim strDate
strDate = cacheFile.DateLastModified
Set objFile = Nothing
Select Case cacheIntervalUnit
Case "minutes"
strUnit = "n"
Case "hours"
strUnit = "h"
Case "days"
strUnit = "d"
End Select
cacheFileIsExpired = (DateDiff(strUnit,CDate(strDate), Now()) > cacheInterval)
If err.Number <> 0 Then
cacheFileIsExpired = True
End If
Set cacheFile = Nothing
Set cacheFSO = Nothing
End Function
Function writeCachedFile(strFileName, strText)
Dim cacheFSO
Set cacheFSO = CreateObject("Scripting.FileSystemObject")
Dim cacheFile
Set cacheFile = cacheFSO.CreateTextFile(strCachePath & strFileName, True, True)
cacheFile.Write(strText)
cacheFile.Close
Set cacheFile = Nothing
Set cacheFSO = Nothing
writeCachedFile = strText
End Function
Function getCachedFile(strFileName)
Dim cacheFSO
Set cacheFSO = CreateObject("Scripting.FileSystemObject")
Dim cacheFile
Set cacheFile = cacheFSO.OpenTextFile(strCachePath & strFileName,1,False,-1)
getCachedFile = cacheFile.ReadAll
Set cacheFile = Nothing
Set cacheFSO = Nothing
End Function
function SafeHTML(ByVal pStrHTML)
'Dim lObjRegExp
'if VarType(pStrHTML) = vbNull Then Exit function
'if pStrHTML = "" Then Exit function
'Set lObjRegExp = New RegExp
'lObjRegExp.Global = True
'lObjRegExp.IgnoreCase = True
'lObjRegExp.Pattern = "<(/)?SCRIPT|META|STYLE([^>]*)>"
'pStrHTML = lObjRegExp.Replace(pStrHTML, "<$1SCRIPT$3>")
'lObjRegExp.Pattern = "<(/)?(LINK|IFRAME|FRAMESET|FRAME|APPLET|OBJECT)([^>]*)>"
'pStrHTML = lObjRegExp.Replace(pStrHTML, "<$1LINK$3>")
'lObjRegExp.Pattern = "(<A[^>]+href\s?=\s?""?javascript
:)[^""]*(""[^>]+>)"
'pStrHTML = lObjRegExp.Replace(pStrHTML, "$1//protected$2")
'lObjRegExp.Pattern = "(<IMG[^>]+src\s?=\s?""?javascript
:)[^""]*(""[^>]+>)"
'pStrHTML = lObjRegExp.Replace(pStrHTML, "$1//protected$2")
'lObjRegExp.Pattern = "<([^>]*) on[^=\s]+\s?=\s?([^>]*)>"
'pStrHTML = lObjRegExp.Replace(pStrHTML, "<$1$3>")
'Set lObjRegExp = Nothing
SafeHTML = pStrHTML
End function
'################################################# #############################################
'This function pulls the thumbnail images frm Flickr and saves them to the local web server
'################################################# #############################################
Function cacheImage(imageURL)
Dim cacheFSO
Set cacheFSO = CreateObject("Scripting.FileSystemObject")
Dim aFileName
aFileName = Split(imageURL,"/")
MediumImageURL = replace(imageURL, "_s.","_m.")
LargeImageURL = replace(imageURL, "_s.","_l.")
Dim strFileName
strFileName = aFileName(UBound(aFileName))
strMediumFileName = replace(strFileName,"_s.","_m.")
strLargeFileName = replace(strFileName,"_s.","_l.")
'################################################# #
'Check to see if the photo has been cached already
'################################################# #
If Not cacheFSO.FileExists(strCachePath & strFileName) Then
Dim objXMLHTTP
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
Dim objJpeg
Set objJpeg = Server.CreateObject("Persits.Jpeg")
objXMLHTTP.Open "GET", imageURL
objXMLHTTP.Send
'###############################################
'Reads the image from Flickr.com
'###############################################
objJpeg.OpenBinary(objXMLHTTP.ResponseBody)
'###############################################
'And saves it to the local web server
'###############################################
objJpeg.Save strCachePath & strFileName
objXMLHTTP.Open "GET", MediumImageURL
objXMLHTTP.Send
'###############################################
'Reads the image from Flickr.com
'###############################################
objJpeg.OpenBinary(objXMLHTTP.ResponseBody)
'###############################################
'And saves it to the local web server
'###############################################
objJpeg.Save strCachePath & strMediumFileName
'objXMLHTTP.Open "GET", LargeImageURL
'objXMLHTTP.Send
'###############################################
'Reads the image from Flickr.com
'###############################################
'objJpeg.OpenBinary(objXMLHTTP.ResponseBody)
'###############################################
'And saves it to the local web server
'###############################################
'objJpeg.Save strCachePath & strLargeFileName
Set objXMLHTTP = Nothing
Set objJpeg = Nothing
End If
Set cacheFSO = Nothing
Set aFileName = Nothing
'Returns the filename, e.g. "myphoto.jpg"
cacheImage = strFileName
Set strFileName = Nothing
End Function
'################################################# #
'Checks to see whether the cached HTML has expired
'################################################# #
If cacheFileIsExpired(strCacheHTML, 1, "n") Then
'################################################# ################################################## ################################################## #
'Creates a collection of XML nodes. The getXMLNode function is passed the URL of the Flickr RSS feed, and the node name for each photo record ("item")
'################################################# ################################################## ################################################## #
Dim objItemList
Set objItemList = getXMLNode(strXMLURL, "item")
Dim objItem, strHTML, ThumbCount, DivCount
ThumbCount = 1
DivCount = 1
ThumbsPerRow = 4
Count = 1
isSingleRow = false
if isSingleRow then
isSingleRowWidth = 360
else
isSingleRowWidth = 200
End if
'###############################################
'Loops through each photo
'###############################################
%>
<%
For Each objItem In objItemList
If ThumbCount <= ThumbsPerRow then
If ThumbCount = 1 and DivCount = 1 then
if Count = 1 then
strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1px; border-style:solid; border-color:#eeeeff;padding:0px;width:" & isSingleRowWidth & "px;height:inherit;'><span style='position:absolute; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2.gif' onclick="\"document.getElementById('flickr1" & DivCount & ").style.display='none" & "';document.getElementById('flickr1" & (DivCount-1+DivCount) & ".style.display='block'\"";"" style='cursor:pointer;'></span><span style='width:'" & isSingleRowWidth & "px';'>"
else
strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1px; border-style:solid; border-color:#eeeeff;padding:0px;width:" & isSingleRowWidth & "px;height:inherit;'><span style='position:absolute; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2.gif' onclick="\"document.getElementById('flickr1" & DivCount & ").style.display='none" & "';document.getElementById('flickr1" & (DivCount-1) & ".style.display='block'\"" style='cursor:pointer;'></span><span style='width:'" & isSingleRowWidth & "px';'>"
End if
strHTML = strHTML & vbTab & "<span style='font-family:arial,verdana,sans-serif;font-size:11px; '><center>" & safeHTML(objItem.childNodes(0).Text) & "</center></span>"
End if
If ThumbCount = 1 and DivCount > 1 then
strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1px; border-style:solid; border-color:#eeeeff;padding:0px;width:" & isSingleRowWidth & "px;display:none;height:inherit;'><span style='width:15px; position:absolute; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2.gif' onclick="\"document.getElementById('flickr" & DivCount & ").style.display='none" & "';document.getElementById('flickr1" & (DivCount-1) & ".style.display='block'\"";"" style='cursor:pointer;'></span><span style='width:'" & isSingleRowWidth & "';'>"
strHTML = strHTML & vbTab & "<span style='font-family:arial,verdana,sans-serif;font-size:11px;text-align:center'><center>" & safeHTML(objItem.childNodes(0).Text) & "</center></span>"
End if
if isSingleRow then
else
If ThumbCount = 3 then
strHTML = strHTML & "<br>"
End if
End if
'################################################# ################################################## ################################################## ###########
'Writes the photo title. The safeHTML function converts some possibly dodgy characters that might be in your title, into valid XHTML (ampersands, accents etc.)
'################################################# ################################################## ################################################## ###########
'strHTML = strHTML & vbTab & "<span>" & safeHTML(objItem.childNodes(0).Text) & "</span>" & vbCrLf
'################################################# ################################################## #
'Writes a link pointing to the photo page on Flickr.com, and writes the URL of the newly cached photo
'################################################# ################################################## #
strHTML = strHTML & vbTab & "<a href=""" & objItem.childNodes(1).Text & """ target=_new onclick=""displayMessage('flickrimage.asp?fn=" & replace(cacheImage(objItem.selectSingleNode("media :thumbnail").getAttribute("url")),"http://www.flickr.com/photos/","") & "&flkr=" & objItem.childNodes(1).Text & "');return false""><img border=0 src=""" & strCacheURL & cacheImage(objItem.selectSingleNode("media:thumbna il").getAttribute("url")) & """ alt=""" & safeHTML(Replace(objItem.childNodes(0).Text & "","""","")) & """ title=""" & safeHTML(Replace(objItem.childNodes(0).Text,""""," ")) & """/></a>"
if ThumbCount = 4 then
if Count = 20 then
strHTML = strHTML & "</span><span style='position:absolute; float:right; top:50%; right:0; vertical-align:middle; line-height:inherit; height:inherit; width:15px;'><img id=fwd" & DivCount & " src='/images/greyrightarrow2.gif' onclick="\"document.getElementById('flickr1" & DivCount & ").style.display='none" & "';document.getElementById('flickr" & (DivCount+1-DivCount) & ".style.display='block'\"" & ;"" style='cursor:pointer;'></span></div>"
DivCount = DivCount + 1
ThumbCount = 0
else
strHTML = strHTML & "</span><span style='position:absolute; float:right; top:50%; right:0; vertical-align:middle; line-height:inherit; height:inherit; width:15px;'><img id=fwd" & DivCount & " src='/images/greyrightarrow2.gif' onclick="\"document.getElementById('flickr1" & DivCount & ").style.display='none" & "';document.getElementById('flickr1" & (DivCount+1) & ".style.display='block'\"" & ;"" style='cursor:pointer;'></span></div>"
DivCount = DivCount + 1
ThumbCount = 0
End if
End if
End if
'response.write "thumbcount: " & thumbcount & "<br>"
'response.write "divcount: " & divcount & "<br>"
if Count = 20 then
exit for
End if
Count = Count + 1
ThumbCount = ThumbCount + 1
Next
if ThumbCount < 4 and ThumbCount > 0 then
strHTML = strHTML & "</span><span position:absolute; float:right; top:50%; right:0; vertical-align:middle; line-height:inherit; height:inherit; border:1px; border-style:solid; ><img id=fwd" & DivCount & " src='/images/greyrightarrow2.gif' onclick='flickr(" & DivCount & ",2);' style='cursor:pointer;'></span></div>"
End if
Set objItemList = Nothing
Set objItem = Nothing
'################################################# #############################################
'Update the HTML cache, and write output to the page
'################################################# #############################################
Response.Write(writeCachedFile(strCacheHTML, strHTML))
Set strHTML = Nothing
Else
'################################################# #############################################
'If cache is not out of date, server up the cached HTML file
'################################################# #############################################
Response.Write(getCachedFile(strCacheHTML))
End If
Set strURL = Nothing
Set strCacheHTML = Nothing
%>