problem with javascript

Discussion in 'ASP .Net' started by sara, Mar 25, 2006.

  1. sara

    sara Guest

    Hi,
    this is the code of a (2005) asp page. I've a problem during the
    execution. When I click on "Leggi" button the javascript function
    "leggi1" is not done! Why?
    Someone can I helm me, please!

    <%@ Page Language="VB" AutoEventWireup="false"
    CodeFile="Homepage.aspx.vb" Inherits="Homepage" %>
    <%@ Import Namespace="System.Data" %>
    <%@ Import Namespace="System.Data.OleDb" %>
    <%@ Import Namespace="System.Data.SqlClient" %>


    <html>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <head>
    <title>Homepage</title>

    <script language=javascript>
    function leggi1(a)
    {
    document.location.replace('Scheda.aspx?libro='+a);
    return false
    }
    </script>

    <script language=vb runat=server>
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load
    Dim cn As OleDbConnection
    Dim cmd As OleDbCommand
    Dim rdr As OleDbDataReader

    Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
    "Data Source=" & Server.MapPath("bookstore.mdb")

    Msg1.Text = "BENVENUTO " & Session("utente") & " "
    cn = New OleDbConnection(ConnString)

    cn.Open()

    Dim titolo As String
    titolo = Request.QueryString("libro")


    Dim sql As String = "SELECT titolo, AUTORE.cognome, lettura_terminata,
    ultimo_letto FROM ((BOOK INNER JOIN LIBRIUTENTE ON
    BOOK.ID=LIBRIUTENTE.libro) INNER JOIN AUTORE on BOOK.autore=AUTORE.ID)
    INNER JOIN UTENTE on UTENTE.ID=LIBRIUTENTE.utente WHERE login='" &
    Session("utente") & "';"


    cmd = New OleDbCommand(sql, cn)

    rdr = cmd.ExecuteReader()
    Response.Write("</br>")
    Response.Write("</br>")
    'Response.Write("<html><body><form>")

    Response.Write("<p>Gli ultimi libri che ha letto sono:</p>")
    Response.Write("<table border=1 cellspacing=1>")
    Response.Write("<tr><th>TITOLO</th><th>AUTORE</th><th>LETTURA
    TERMINATA</th><th>ULTIMO PARAGRAFO LETTO</th></tr>")
    If rdr.HasRows Then


    While (rdr.Read())
    Response.Write("<tr>")
    Response.Write("<td>" & rdr.Item(0) & "</td>")
    Response.Write("<td>" & rdr.Item(1) & "</td>")
    Response.Write("<td>" & rdr.Item(2) & "</td>")
    Response.Write("<td>" & rdr.Item(3) & "</td>")
    Response.Write("<td><input type=button value=Leggi onclick='return
    leggi1(" & rdr.Item(0) & ");'></td>")
    Response.Write("</tr>")
    End While

    Response.Write("</table>")
    'Response.Write("</form>")
    'Response.Write("</body></html>")
    Else
    Msg2.Text = ("Non hai letto ancora nessun libro")
    End If
    rdr.Close()
    cn.Close()
    End Sub
    </script>
    </head>
    <body>
    <form id="form1" runat="server">
    <div>
    <P>
    <asp:Label ID="Msg1" runat="server" ForeColor="MidnightBlue"
    Style="z-index: 108; left: 16px;
    position: absolute; top: 19px" Font-Bold="True" Font-Size="Large"
    Height="24px" Width="424px"></asp:Label>
    </P>
    <p>Per effettuare la ricerca di un libro inserire i parametri
    <br />
    <br />
    <asp:Label ID="Label1" runat="server" Text="Inserisci Titolo"
    Width="160px" Font-Size="Large" Height="24px"></asp:Label>
    <asp:TextBox ID="txttitolo" runat="server" Font-Size="Large"
    Height="25px"></asp:TextBox>
    <asp:Button ID="Button2" runat="server" Text="Cerca" Font-Size="Large"
    Height="32px" Width="72px" />
    <br />
    <br />
    <asp:Label ID="Label2" runat="server" Text="Inserisci Autore"
    Font-Size="Large" Height="24px" Width="160px"></asp:Label>
    <asp:TextBox ID="txtautore" runat="server" Font-Size="Large"
    Height="25px"></asp:TextBox>
    <asp:Button ID="Button1" runat="server" Text="Cerca" Font-Size="Large"
    Height="32px" Width="72px" />
    <br />
    <br />
    <asp:Label ID="Msg2" runat="server" Font-Bold="False" ForeColor="Red"
    Style="z-index: 108; left: 560px; position: absolute; top: 320px"
    Font-Size="Large" Height="32px" Width="352px"></asp:Label>


    </p>
    </div>
    </form>
    </body>
    </html>
    sara, Mar 25, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mcdeveloper
    Replies:
    1
    Views:
    4,169
    mcdeveloper
    Jun 13, 2006
  2. CRON
    Replies:
    24
    Views:
    200,435
    Adrienne Boswell
    Jun 20, 2006
  3. Mark Rae

    JavaScript or not JavaScript

    Mark Rae, Sep 5, 2006, in forum: ASP .Net
    Replies:
    36
    Views:
    1,064
    Paul Sture
    Sep 9, 2006
  4. Nathan Sokalski
    Replies:
    4
    Views:
    565
    PJ on Development
    Nov 8, 2007
  5. Andy
    Replies:
    2
    Views:
    216
    kaeli
    Mar 4, 2004
Loading...

Share This Page