Minor JavaScript compatibility problem with Mozilla

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • danielji
    New Member
    • Dec 2007
    • 10

    Minor JavaScript compatibility problem with Mozilla

    Hi,
    I am working to display a Flickr rss feed of photos on my website and have users cycle through the photos using a set of javacript/asp arrow buttons. It all seems to work fine on IE but the buttons are not working on Mozilla. It must be a small rule or statement I missed.

    The code below is a snippet of what is being used for one of the arrow buttons.


    [CODE=vb] strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & (DivCount-1+DivCount) & ".style.display ='" & "';"" style='cursor:p ointer;'></span><span style='width=:' " & isSingleRowWidt h & "';'>"


    else

    strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & DivCount-1 & ".style.display ='" & "';"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "';'>"[/CODE]

    any suggestions?
    Last edited by gits; Jan 8 '08, 05:50 PM. Reason: added code tags
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5388

    #2
    hi ...

    i guess the problem is with setting the divs style.display to an empty value instead of using 'block' ... to make it visible?

    kind regards

    Comment

    • danielji
      New Member
      • Dec 2007
      • 10

      #3
      Originally posted by gits
      hi ...

      i guess the problem is with setting the divs style.display to an empty value instead of using 'block' ... to make it visible?

      kind regards
      Yes, I forgot to mention that I did try inserting "block" into all the empty values and yet the buttons still do not work on Mozilla. Here is the code as I have it now. The error I receive in the Mozilla Error Console whenever I click on the button to change the photo is "window.fli ckr1 has no properties.... any help would be appreciated.




      [CODE=vb]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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & (DivCount-1+DivCount) & ".style.display ='block" & "';"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


      else

      strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & DivCount-1 & ".style.display ='block" & "';"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


      End if

      strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px; '><center>" & safeHTML(objIte m.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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;display:non e;height:inheri t;'><span style='width:15 px; position:absolu te; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2. gif' onclick=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & DivCount-1 & ".style.display ='block" & "';"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "';'>"
      strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px;text-align:center'>< center>" & safeHTML(objIte m.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(objIte m.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.childNo des(1).Text & """ target=_new onclick=""displ ayMessage('flic krimage.asp?fn= " & replace(cacheIm age(objItem.sel ectSingleNode(" media:thumbnail ").getAttribute ("url")),"ht tp://www.flickr.com/photos/","") & "&flkr=" & objItem.childNo des(1).Text & "');return false""><img border=0 src=""" & strCacheURL & cacheImage(objI tem.selectSingl eNode("media:th umbnail").getAt tribute("url")) & """ alt=""" & safeHTML(Replac e(objItem.child Nodes(0).Text & "","""","") ) & """ title=""" & safeHTML(Replac e(objItem.child Nodes(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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & (DivCount+1-DivCount) & ".style.display ='block" & "';"" style='cursor:p ointer;'></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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick=""windo w.flickr" & DivCount & ".style.display ='none" & "';window.flick r" & DivCount+1 & ".style.display ='block" & "';"" style='cursor:p ointer;'></span></div>"
      DivCount = DivCount + 1
      ThumbCount = 0

      End if

      End if

      End if[/CODE]
      Last edited by gits; Jan 8 '08, 05:51 PM. Reason: added code tags

      Comment

      • gits
        Recognized Expert Moderator Expert
        • May 2007
        • 5388

        #4
        you could try:

        [CODE=javascript]onclick="\"docu ment.getElement ById('flickr" & DivCount & ").style.displa y = 'block';\""
        [/CODE]
        instead, to refer to the node with standards compliant dom-methods, note: flickr1 must be the id then

        kind regards

        Comment

        • danielji
          New Member
          • Dec 2007
          • 10

          #5
          Originally posted by gits
          you could try:

          [CODE=javascript]onclick="\"docu ment.getElement ById('flickr" & DivCount & ").style.displa y = 'block';\""
          [/CODE]
          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.fli ckr" statements with document.getEle mentById but I'm still encountering trouble..



          <script type="text/javascript">
          messageObj = new DHTML_modalMess age(); // We only create one object of this class
          messageObj.setS hadowOffset(5); // Large shadow


          function displayMessage( url)
          {

          messageObj.setS ource(url);
          messageObj.setC ssClassMessageB ox(false);
          messageObj.setS ize(400,400);
          messageObj.setS hadowDivVisible (true); // Enable shadow for these boxes
          messageObj.disp lay();
          }

          function displayStaticMe ssage(messageCo ntent,cssClass)
          {
          messageObj.setH tmlContent(mess ageContent);
          messageObj.setS ize(400,400);
          messageObj.setC ssClassMessageB ox(cssClass);
          messageObj.setS ource(false); // no html source since we want to use a static message here.
          messageObj.setS hadowDivVisible (false); // Disable shadow for these boxes
          messageObj.disp lay();


          }

          function closeMessage()
          {
          messageObj.clos e();
          }


          </script>

          <%

          isFirecrest = NULL
          strIPAddress = request.serverv ariables("REMOT E_ADDR")
          Call fn_CheckNetwork (strIPAddress,i sFirecrest)


          '############## ############### ############### ############### ############### ############### #####
          '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.g ne?id=16512192@ N08&lang=en-us&format=rss_2 00"

          '############## ############### ############### #####
          '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\servero ne\www\nanet.br itainusa.com\im ages\flickrfeed \"


          '############## ############### ############### #####
          'The public URL to the above cache directory, e.g.
          '############## ############### ############### #####


          Dim strCacheURL

          if isFirecrest then
          strCacheURL = "https://nanet.britainus a.com/images/flickrfeed/"
          else
          strCacheURL = "http://nanet.britainus a.com/images/flickrfeed/"
          End if


          '############## ############### ############### ############### ############### ############### #####
          'This function takes the URL of the RSS feed, and the XML node name of each photo
          '############## ############### ############### ############### ############### ############### #####


          Function getXMLNode(strU RL, strNode)

          Dim objXML
          Set objXML = Server.CreateOb ject("MSXML2.Fr eeThreadedDOMDo cument")
          objXML.Async = False
          objXML.setPrope rty "ServerHTTPRequ est", True
          objXML.Load(str URL)

          '############## ############### ############### ########
          'Returns a collection of nodes to be looped through
          '############## ############### ############### ########


          Set getXMLNode = objXML.getEleme ntsByTagName(st rNode)
          Set objXML = Nothing

          End Function



          Function cacheFileIsExpi red(strFileName , cacheInterval, cacheIntervalUn it)

          If cacheInterval = 0 Then
          cacheFileIsExpi red = True
          Exit Function
          End If


          On Error Resume Next


          Dim cacheFSO
          Set cacheFSO = CreateObject("S cripting.FileSy stemObject")

          Dim cacheFile
          Set cacheFile = cacheFSO.GetFil e(strCachePath & strFileName)

          Dim strDate
          strDate = cacheFile.DateL astModified
          Set objFile = Nothing

          Select Case cacheIntervalUn it

          Case "minutes"
          strUnit = "n"

          Case "hours"
          strUnit = "h"

          Case "days"
          strUnit = "d"
          End Select

          cacheFileIsExpi red = (DateDiff(strUn it,CDate(strDat e), Now()) > cacheInterval)

          If err.Number <> 0 Then
          cacheFileIsExpi red = True
          End If

          Set cacheFile = Nothing
          Set cacheFSO = Nothing

          End Function








          Function writeCachedFile (strFileName, strText)

          Dim cacheFSO
          Set cacheFSO = CreateObject("S cripting.FileSy stemObject")

          Dim cacheFile
          Set cacheFile = cacheFSO.Create TextFile(strCac hePath & strFileName, True, True)
          cacheFile.Write (strText)
          cacheFile.Close

          Set cacheFile = Nothing
          Set cacheFSO = Nothing
          writeCachedFile = strText

          End Function







          Function getCachedFile(s trFileName)

          Dim cacheFSO
          Set cacheFSO = CreateObject("S cripting.FileSy stemObject")

          Dim cacheFile
          Set cacheFile = cacheFSO.OpenTe xtFile(strCache Path & strFileName,1,F alse,-1)

          getCachedFile = cacheFile.ReadA ll

          Set cacheFile = Nothing
          Set cacheFSO = Nothing

          End Function



          function SafeHTML(ByVal pStrHTML)

          'Dim lObjRegExp
          'if VarType(pStrHTM L) = vbNull Then Exit function
          'if pStrHTML = "" Then Exit function
          'Set lObjRegExp = New RegExp
          'lObjRegExp.Glo bal = True
          'lObjRegExp.Ign oreCase = True
          'lObjRegExp.Pat tern = "<(/)?SCRIPT|META|S TYLE([^>]*)>"
          'pStrHTML = lObjRegExp.Repl ace(pStrHTML, "<$1SCRIPT$ 3>")
          'lObjRegExp.Pat tern = "<(/)?(LINK|IFRAME| FRAMESET|FRAME| APPLET|OBJECT)([^>]*)>"
          'pStrHTML = lObjRegExp.Repl ace(pStrHTML, "<$1LINK$3> ")
          'lObjRegExp.Pat tern = "(<A[^>]+href\s?=\s?""? javascript:)[^""]*(""[^>]+>)"
          'pStrHTML = lObjRegExp.Repl ace(pStrHTML, "$1//protected$2")
          'lObjRegExp.Pat tern = "(<IMG[^>]+src\s?=\s?""?j avascript:)[^""]*(""[^>]+>)"
          'pStrHTML = lObjRegExp.Repl ace(pStrHTML, "$1//protected$2")
          'lObjRegExp.Pat tern = "<([^>]*) on[^=\s]+\s?=\s?([^>]*)>"
          'pStrHTML = lObjRegExp.Repl ace(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(imag eURL)

          Dim cacheFSO
          Set cacheFSO = CreateObject("S cripting.FileSy stemObject")

          Dim aFileName
          aFileName = Split(imageURL, "/")
          MediumImageURL = replace(imageUR L, "_s.","_m." )
          LargeImageURL = replace(imageUR L, "_s.","_l." )

          Dim strFileName
          strFileName = aFileName(UBoun d(aFileName))
          strMediumFileNa me = replace(strFile Name,"_s.","_m. ")
          strLargeFileNam e = replace(strFile Name,"_s.","_l. ")

          '############## ############### ############### ######
          'Check to see if the photo has been cached already
          '############## ############### ############### ######


          If Not cacheFSO.FileEx ists(strCachePa th & strFileName) Then

          Dim objXMLHTTP
          Set objXMLHTTP = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")

          Dim objJpeg
          Set objJpeg = Server.CreateOb ject("Persits.J peg")


          objXMLHTTP.Open "GET", imageURL
          objXMLHTTP.Send

          '############## ############### ############### ###
          'Reads the image from Flickr.com
          '############## ############### ############### ###



          objJpeg.OpenBin ary(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.OpenBin ary(objXMLHTTP. ResponseBody)



          '############## ############### ############### ###
          'And saves it to the local web server
          '############## ############### ############### ###

          objJpeg.Save strCachePath & strMediumFileNa me




          'objXMLHTTP.Ope n "GET", LargeImageURL
          'objXMLHTTP.Sen d

          '############## ############### ############### ###
          'Reads the image from Flickr.com
          '############## ############### ############### ###



          'objJpeg.OpenBi nary(objXMLHTTP .ResponseBody)



          '############## ############### ############### ###
          'And saves it to the local web server
          '############## ############### ############### ###

          'objJpeg.Save strCachePath & strLargeFileNam e



          Set objXMLHTTP = Nothing
          Set objJpeg = Nothing

          End If

          Set cacheFSO = Nothing
          Set aFileName = Nothing

          'Returns the filename, e.g. "myphoto.jp g"

          cacheImage = strFileName

          Set strFileName = Nothing

          End Function

          '############## ############### ############### ######
          'Checks to see whether the cached HTML has expired
          '############## ############### ############### ######


          If cacheFileIsExpi red(strCacheHTM L, 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(strX MLURL, "item")

          Dim objItem, strHTML, ThumbCount, DivCount
          ThumbCount = 1
          DivCount = 1
          ThumbsPerRow = 4
          Count = 1

          isSingleRow = false

          if isSingleRow then
          isSingleRowWidt h = 360
          else
          isSingleRowWidt h = 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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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="\"docu ment.getElement ById('flickr1" & DivCount & ").style.displa y='none" & "';document.get ElementById('fl ickr1" & (DivCount-1+DivCount) & ".style.display ='block'\"";"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


          else

          strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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="\"docu ment.getElement ById('flickr1" & DivCount & ").style.displa y='none" & "';document.get ElementById('fl ickr1" & (DivCount-1) & ".style.display ='block'\"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


          End if

          strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px; '><center>" & safeHTML(objIte m.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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;display:non e;height:inheri t;'><span style='width:15 px; position:absolu te; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2. gif' onclick="\"docu ment.getElement ById('flickr" & DivCount & ").style.displa y='none" & "';document.get ElementById('fl ickr1" & (DivCount-1) & ".style.display ='block'\"";"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "';'>"
          strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px;text-align:center'>< center>" & safeHTML(objIte m.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(objIte m.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.childNo des(1).Text & """ target=_new onclick=""displ ayMessage('flic krimage.asp?fn= " & replace(cacheIm age(objItem.sel ectSingleNode(" media:thumbnail ").getAttribute ("url")),"ht tp://www.flickr.com/photos/","") & "&flkr=" & objItem.childNo des(1).Text & "');return false""><img border=0 src=""" & strCacheURL & cacheImage(objI tem.selectSingl eNode("media:th umbnail").getAt tribute("url")) & """ alt=""" & safeHTML(Replac e(objItem.child Nodes(0).Text & "","""","") ) & """ title=""" & safeHTML(Replac e(objItem.child Nodes(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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick="\"docu ment.getElement ById('flickr1" & DivCount & ").style.displa y='none" & "';document.get ElementById('fl ickr" & (DivCount+1-DivCount) & ".style.display ='block'\"" & ;"" style='cursor:p ointer;'></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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick="\"docu ment.getElement ById('flickr1" & DivCount & ").style.displa y='none" & "';document.get ElementById('fl ickr1" & (DivCount+1) & ".style.display ='block'\"" & ;"" style='cursor:p ointer;'></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:absolu te; 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:p ointer;'></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(s trCacheHTML))

          End If

          Set strURL = Nothing
          Set strCacheHTML = Nothing



          %>

          Comment

          • gits
            Recognized Expert Moderator Expert
            • May 2007
            • 5388

            #6
            aaarg, sorry my bad ... we missed a single-quote before the bracket:

            [CODE=javascript]onclick="\"docu ment.getElement ById('flickr" & DivCount & "').style.displ ay = 'block';\""
            [/CODE]
            in case it is not working ... what error do you get?

            kind regards

            Comment

            • danielji
              New Member
              • Dec 2007
              • 10

              #7
              Originally posted by gits
              aaarg, sorry my bad ... we missed a single-quote before the bracket:

              [CODE=javascript]onclick="\"docu ment.getElement ById('flickr" & DivCount & "').style.displ ay = 'block';\""
              [/CODE]
              in case it is not working ... what error do you get?

              kind regards

              Hello again, I tried with the additional single-quote but I still receive an error and the rest of the page will not load. Here is the error:



              Microsoft VBScript runtime error '800a000d'

              Type mismatch: '[string: " src='/images/greyle"]'

              /flickrcache2.as p, line 392





              these are the changes I made to the code:

              [CODE=vb]<%


              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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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="\"docu ment.getElement ById('flickr" & DivCount & "').style.displ ay='none" & "';document.get ElementById('fl ickr" & (DivCount-1+DivCount) & "').style.displ ay='block';\"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


              else

              strHTML = strHTML & "<div id='flickr" & DivCount & "' class='flickr-tn" & DivCount & "' style='border:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;height:inhe rit;'><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="\"docu ment.getElement ById('flickr" & DivCount & "').style.displ ay='none" & "';document.get ElementById('fl ickr1" & (DivCount-1) & "').style.displ ay='block';\"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "px';'>"


              End if

              strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px; '><center>" & safeHTML(objIte m.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:1 px; border-style:solid; border-color:#eeeeff;p adding:0px;widt h:" & isSingleRowWidt h & "px;display:non e;height:inheri t;'><span style='width:15 px; position:absolu te; float:left; top:50%; left:0; vertical-align:middle; line-height:inherit; height:inherit; '><img id=bwd" & DivCount & " src='/images/greyleftarrow2. gif' onclick="\"docu ment.getElement ById('flickr" & DivCount & "').style.displ ay='none" & "';document.get ElementById('fl ickr1" & (DivCount-1) & "').style.displ ay='block';\"" style='cursor:p ointer;'></span><span style='width:'" & isSingleRowWidt h & "';'>"
              strHTML = strHTML & vbTab & "<span style='font-family:arial,ve rdana,sans-serif;font-size:11px;text-align:center'>< center>" & safeHTML(objIte m.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(objIte m.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.childNo des(1).Text & """ target=_new onclick=""displ ayMessage('flic krimage.asp?fn= " & replace(cacheIm age(objItem.sel ectSingleNode(" media:thumbnail ").getAttribute ("url")),"ht tp://www.flickr.com/photos/","") & "&flkr=" & objItem.childNo des(1).Text & "');return false""><img border=0 src=""" & strCacheURL & cacheImage(objI tem.selectSingl eNode("media:th umbnail").getAt tribute("url")) & """ alt=""" & safeHTML(Replac e(objItem.child Nodes(0).Text & "","""","") ) & """ title=""" & safeHTML(Replac e(objItem.child Nodes(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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick="\"docu ment.getElement ById('flickr1" & DivCount & "').style.displ ay='none" & "';document.get ElementById('fl ickr" & (DivCount+1-DivCount) & "').style.displ ay='block'\"" & ;"" style='cursor:p ointer;'></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;'><i mg id=fwd" & DivCount & " src='/images/greyrightarrow2 .gif' onclick="\"docu ment.getElement ById('flickr1" & DivCount & "').style.displ ay='none" & "';document.get ElementById('fl ickr1" & (DivCount+1) & "').style.displ ay='block'\"" & ;"" style='cursor:p ointer;'></span></div>"
              DivCount = DivCount + 1
              ThumbCount = 0

              End if

              End if

              End if[/CODE]
              Last edited by gits; Jan 8 '08, 05:49 PM. Reason: added code tags

              Comment

              • gits
                Recognized Expert Moderator Expert
                • May 2007
                • 5388

                #8
                hi ...

                hmmmmm ... there might be a problem after the 'block' word ... you have:

                .... block;\"" style ...

                i think this ends the string ... and may be you should remove one double quote there ... but basically you sould ensure the correct usage of singe, double and escaped quotes ...

                and posting one example would be enough ... :) you don't need to always post the entire code ...

                kind regards

                Comment

                • danielji
                  New Member
                  • Dec 2007
                  • 10

                  #9
                  Thank you for your help, and apologies for cluttering the forum with all that code! I'll give it a try.

                  Comment

                  Working...