Newbie Q: calling access data on onclick function

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Newbie Q: calling access data on onclick function

    I am working on a page which will post a set of images which can be
    clicked upon to show a larger image along with information associated
    with the image from the access data table(s) onto a pseudo-window
    using CSS (to avoid pop-up blockers). So basically, I call the images
    from the table and display them on the page. When one is clicked, a
    'window' will open showing the info associated with that particular
    image. Given that there will be a large number of pictures (1000+),
    each with several data associated with it, using an array is not
    practical to pull the data so I'd like to call the data using another
    sql call associated with, say, the image name.

    Anyone know how I might go about this??

    Thanks in advance,

    Jeremy

    PS: Here is my code so far-

    <%@LANGUAGE="JAVASCRIPT"%>

    <head>
    <script language="JavaScript">
    <%

    var imgs="";
    var ident=0;
    var pics = "";

    var conn = Server.CreateObject("ADODB.Connection");
    var rs = Server.CreateObject("ADODB.Recordset");
    var sql1 = "SELECT DISTINCT * FROM Photos, Artists WHERE
    Photos.[Artist ID] = Artists.[Artist ID] ORDER BY Photos.Entered
    DESC";
    conn.Open("DSN=photo");
    rs.Open(sql1,conn);

    var n=0;
    var i=0;
    var j=0;
    while (!rs.EOF)
    {
    var img = rs.Fields("Photo").value;
    var art = rs.Fields("Artist").value;
    var ttl = rs.Fields("Title").value;
    var spc = rs.Fields("Species").value;
    var dsc = rs.Fields("Description").value;
    var org = rs.Fields("Organization").value;
    var ad1 = rs.Fields("Address1").value;
    var cty = rs.Fields("City").value;
    var stt = rs.Fields("State").value;
    var zip = rs.Fields("Zip").value;
    var cry = rs.Fields("Country").value;
    var eml = rs.Fields("Email").value;
    var web = rs.Fields("Web").value;
    var pics = pics += "<td id=" + i + "
    onClick=\"Pic_Do();Pic_Get(this);\"><img name='" + img + "' src
    ='../images/photos/" + img + "' width='100' height='100'>
    &nbsp;<br>\n";
    rs.MoveNext();

    var imgs = imgs += "src[" + i + "] ='../images/photos/" + img +
    "'\n";
    i=i+1;
    }
    rs.Close();
    %>

    function Pic_Do() {
    document.forms['winForm'].className='winShow'
    }
    function Pic_Get(cell) {
    var ident = cell.id;
    var src = new Array();
    <%=imgs%>
    document.images['SelPic'].src = src[ident];

    }
    </script>
    <style type="text/css">
    <!--
    ..pics {
    position: absolute;
    left: 130px;
    top: 115px;
    font-size: small;
    }
    ..WinHide {
    visibility: hidden;
    position: absolute;
    height: 1px;
    width: 1px;
    left: 100px;
    top: 120px;
    }
    ..WinShow {
    position: absolute;
    visibility: visible;
    height: 250px;
    width: 500px;
    left: 100px;
    top: 120px;
    }
    -->
    </style>
    </head>
    <html>
    <BODY>

    <FORM id="pic" name="picform" class="pics">
    <table>
    <tr>
    <%=pics%>
    </tr>
    </table>
    </FORM>
    <span id="win" class="WinHide">
    <form name="winForm">
    <table>
    <tr>
    <td>
    <img name="SelPic" height="200" width="200"><br>
    </td>
    <td>
    <b>Title: </b><br>
    <b>Species: </b><br>
    <b>Description: </b><br>
    <b>Photographer: </b><br>
    <b>Organization: </b><br>
    <b>Address: </b><br>
    <b>Email: </b><br>
    <b>Web Site: </b><br>
    </td>
    </tr>
    </table>

    <center>
    <input type="Button"
    OnClick="document.forms['winForm'].className='WinHide'" value="Close
    Window">
    </center>

    </form>
    </span>
    </BODY>
    </HTML>
    Jeremy Guest

  2. Similar Questions and Discussions

    1. Calling a php Function from an onClick event
      I need to create a hyperlink that calls a php function when clicked. How would I do that (with or without Javascript)? Any feedback is appreciated!
    2. onClick without loosing data
      I have a page with several radio buttons. (Add, Deactivate). When I click on Add, an add form is displayed on a page and when and it works the...
    3. Calling a function within a function registered to an event
      Hey, Just registered and tried to search through the forum for a solution to my problem, but I haven't found anything that could help me. I've...
    4. Error calling MS-Access Module Function from SQL
      Lars wrote: Unfortunately, user-defined procedures in an Access module are only accessible when Access is running. There are security...
    5. data access in a udf table function
      Toralf Kirsten <tkirsten@izbi.uni-leipzig.de> wrote: Yes, you can access tables. For example: CREATE FUNCTION all_tables() RETURNS TABLE (...
  3. #2

    Default Re: Newbie Q: calling access data on onclick function

    Jeremy wrote on 08 jul 2004 in microsoft.public.inetserver.asp.db:
    > I am working on a page which will post a set of images which can be
    > clicked upon to show a larger image along with information associated
    > with the image from the access data table(s) onto a pseudo-window
    > using CSS (to avoid pop-up blockers). So basically, I call the images
    > from the table and display them on the page. When one is clicked, a
    > 'window' will open showing the info associated with that particular
    > image. [snip]
    You are making an serverside variant string called pics,
    that you are never using.

    So I cannot fathom what you would want to do.


    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)
    Evertjan. Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139