如何让CFDIV每行下显示?CFDIV

2023-09-11 01:29:55 作者:余生

我有记录的表,用户可以点击一个名字以示对某些记录更详细的信息。我有它设置了一个标记,但该链接被点击它每次只显示在页面的顶部或第一个行。有没有办法让它在每个名称显示,当它被点击。这里是code我有...

 <表格的宽度=75%的边界=1>
  &其中; TR>
    <第i个学生姓名< /第i个
  < / TR>
  < CFOUTPUT查询=Q>
  &其中; TR>
    &其中; TD>&所述; A HREF =javascript的:ColdFusion.navigate('detailedRecord.cfm RLN =#RLN#?,细节)>#Q.sln#,#Q.sfn#&所述; / a取代;< / TD>
  < / TR>
  &其中; TR>
    < TD>< CFDIV ID =细节>< / CFDIV>< / TD>
  < / TR>
  < / CFOUTPUT>
< /表>
 

解决方案

既然你是在一个循环< CFOUTPUT查询=Q> 您需要让详细信息 A的唯一的标识符。当你把它写你的循环每次迭代具有相同的ID。也许只是添加当前的行号,使其独特的。

 <表格的宽度=75%的边界=1>
  &其中; TR>
    <第i个学生姓名< /第i个
  < / TR>
  < CFOUTPUT查询=Q>
  &其中; TR>
    &其中; TD>&其中;一个href="javascript:ColdFusion.navigate('detailedRecord.cfm?RLN=#RLN#','detail#Q.CurrentRow#')">#Q.sln#, #Q.sfn#&所述; / a取代;&所述; / TD>
  < / TR>
  &其中; TR>
    < TD>< CFDIV ID =#详细#Q.CurrentRow>< / CFDIV>< / TD>
  < / TR>
  < / CFOUTPUT>
< /表>
 

怎样让电脑屏幕下方显示你的名字

I have a table of records and the user can click on a name to show more detailed information about that certain record. I have it set up with a tag but each time the link is clicked it only shows up on the top of the page or the very first row. Is there a way to get it to show under each name when it is click. Here is the code I have...

<table width="75%" border="1">
  <tr>
    <th>Student Name</th>
  </tr>
  <cfoutput query="Q">
  <tr>
    <td><a href="javascript:ColdFusion.navigate('detailedRecord.cfm?RLN=#RLN#','detail')">#Q.sln#, #Q.sfn#</a></td>
  </tr>
  <tr>
    <td><cfdiv id="detail"></cfdiv></td>
  </tr>
  </cfoutput>
</table>

解决方案

Since you are in a loop <cfoutput query="Q"> you will need to make detail a unique identifier. As you have it written every iteration of your loop has the same id. Maybe just add the current row number to make it unique.

<table width="75%" border="1">
  <tr>
    <th>Student Name</th>
  </tr>
  <cfoutput query="Q">
  <tr>
    <td><a href="javascript:ColdFusion.navigate('detailedRecord.cfm?RLN=#RLN#','detail#Q.CurrentRow#')">#Q.sln#, #Q.sfn#</a></td>
  </tr>
  <tr>
    <td><cfdiv id="detail#Q.CurrentRow#"></cfdiv></td>
  </tr>
  </cfoutput>
</table>