Visualizzazione dei risultati da 1 a 3 su 3
  1. #1
    Utente di HTML.it
    Registrato dal
    Jul 2007
    Messaggi
    159

    script per rotazione immagini

    Salve a tutti, ho scaricato uno script per la rotazione delle immagini ma non funziona...
    Lo script è questo:
    <%@ LANGUAGE = "VBScript" %>
    <%Option Explicit%>

    <%
    'This function will get an Ad of the format specified by "format" (string, eg. "468x60", "120x100")
    ' and based on the "randomize" integer. This function does not truely randomize, if the
    ' same parameters are passed in, the same Ad will display (unless a new Ad is inserted). The
    ' calling page should use it's own random generating code to choose the Ad to display.
    function ShowAd(format, randomize)
    Dim conn, rs, str_sql, str_conn, intRsCount

    Set conn = Server.CreateObject("ADODB.Connection")
    Set rs = Server.CreateObject("ADODB.Recordset")
    str_conn = "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" & server.mappath("\AdRotate.mdb")

    conn.Open str_conn

    'Get the Ads
    str_sql = "SELECT Link FROM Ads WHERE Format LIKE '" & format & "' AND InRotation = true"
    rs.Open str_sql, conn, 1, 2

    'Get the number of Ads that meet the criteria
    intRsCount = rs.RecordCount

    'Move a "random" number of records without going over the size of the
    ' recordset.
    rs.Move(randomize Mod intRsCount)

    'There should always be a record here, but it's better to be safe
    If Not(rs.EOF) Then
    ShowAd = rs("Link")
    Else
    ShowAd = ""
    End If

    rs.Close
    conn.Close
    Set rs = Nothing
    Set conn = Nothing
    end function
    %>

    <%

    'Usage Examples

    'I use the following equation to generate a fairly random number based on
    ' the time the page is loaded. This basically returns the number of
    ' seconds from the current time. If you have more than 60 ads, this
    ' will not be a good number generator.
    Dim AdSeed
    AdSeed = Mid(Now(), Len(Now()) - 4, 2)


    'Display a single 468x60 Ad
    Response.Write ShowAd("468x60", AdSeed) + "
    "

    'Display a pair of Ads with a width of 120 and where height is unimportant
    Response.Write ShowAd("120x%", AdSeed)
    Response.Write ShowAd("120x%", AdSeed + 1) + "
    "

    %>

    Però non funziona e non riesco a trovare l'errore
    Firefox all'apertura della pagina http://www.materamachi.com/AdRotate.asp
    mi dice

    Microsoft VBScript runtime error '800a000b'
    Division by zero
    /AdRotate.asp, line 27

    L'esempio l'ho scaricato da questo link
    http://asp.html.it/script/vedi/3573/ad-rotator/

    Aiutoooooo!
    Ciao

  2. #2
    Probabilmente nel database non c'è nessun record.

  3. #3
    Utente di HTML.it
    Registrato dal
    Jul 2007
    Messaggi
    159
    Nel database ho inserito cinque record!
    Ciao

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.