ms-accessiframecoldfusioncoldfusion-10coldfusionbuilder

How to link a query with an iframe


I know how to manually create an iframe by linking each image to a name.

<a href="0604-013037 - Financial Aid.png" target="viewframe">3501 Nebraska Ave. NW</a>

<iframe name="viewframe" style="display:block;height:1000px;width:1000px"></iframe>

Then using ColdFusion I can also create a table of data.

Number    Name    State

What I want to know, if there is a way to link a query with an iFrame? So that each piece of data is linked with an image that would appear in the iFrame. So that when you select the information from the table an image would appear.

<cfquery datasource="AccessTest" name="qTest">
    SELECT Name, State, Number
    FROM List       
</cfquery>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>
        Displaying a Query in a table
    </title>
</head>

    <div id="content">
        <h1>
            Displaying a Query in a Table
        </h1>
        <table width="600" border="1" cellspacing="0">
        <tr>
            <td><b>Number</b></td>
            <td><b><!---Bolds --->Name</b></td>
            <td><b>State</b></td>
        </tr>
        <cfoutput query="qTest">
            <tr>
                <td>#qTest.Number#</td>
                <td>#qTest.Name#</td>
                <td>#qTest.State#</td>
            </tr>
        </cfoutput>
        </table>
    </div>

Solution

  • If I understand your question correctly you would just need to add the desired information from the query to your <cfoutput> tags. Something like this:

    <cfoutput query="qTest">
        <tr>
            <td>#qTest.Number#</td>
            <td>#qTest.Name#</td>
            <td>#qTest.State#</td>
            <td><a href="#qTest.unique_image#" target="viewframe">#qTest.unique_description#</a></td>
        </tr>
    </cfoutput>
    

    Notice that I am making some assumptions here:

    1. That your query can also return the path and file name of the unique image that you would like for each link
    2. That your query can also return the unique image description that you would like displayed for each link