2

At a loss here. Have similar code working...

Cannot get hidden td or when changed to div it doesn't show either... This is not a coldfusion problem I don't think...

Required Javascript

 <script type="text/javascript">
  function showElement(layer){
  var myLayer = document.getElementById(layer);
  if(myLayer.style.display=="none"){
  myLayer.style.display="block";
  myLayer.backgroundPosition="top";
  } else { 
 myLayer.style.display="none";
  }
  }
 </script>

This Cold Fusion Code all works fine and displays fine in tables... When I add the function to hide it - I can't get it to display... The typeid is different each time...

 <table cellpadding=2 cellspacing=2 align=center border=1>
<cfoutput query=list group="typeid">
    <cfquery name="gl" datasource="#ds#">
    select * from shindates
    where sdate <= #monthdate# and stime >= #createODBCDateTime(timenow)# and typeid = '#typeid#'
    order by typeid, sdate
    </cfquery>
    <cfquery name="type" datasource="#ds#">
    select * from type
    where typeid = '#typeid#'
    </cfquery>
    <tr>
    <td><img src="../images/edit.png" alt="Edit" width=25 border=0 alt="Show List" onclick="javascript:showElement('#typeid#')"></td>
    <td valign=middle class=verd10>#type.type#</td>
    </tr>
    <tr>
    <td colspan=2 id="#typeid#" style="display: none">

        <cfloop query="gl">
        <table cellpadding=5 cellspacing=5 align=center class=general>
        <tr>
        <td colspan=2>
        #type.type# - #Dateformat(gl.sdate, 'dddd - mmm dd, yyyy')# - #Timeformat(gl.stime, 'HH:mm')#<br>
        </td>
        </tr>
        <tr>
        <cfset csigned = signedup + gsignedup>
        <cfif csigned is not 0>
        <td class=verd9 align=center><b>Unable to Cancel - Users Signed Up</b></td>
        <td class=verd9 align=center>
        <cfform action="adminmanage.cfm?shinid=#gl.shinid#" method="post">
        <input type="submit" value="Manage List" class="legal8">
        <input type="hidden" value="#gl.shinid#" name="shinid">
        </cfform>
        </td>
        <cfelse>
        <td class=verd9 align=center>
        <cfform action="adminlist.cfm?src=del" method="post">
        <input type="submit" value="Cancel" class="legal8">
        <input type="hidden" value="#gl.shinid#" name="shinid">
        </cfform>
        </td>
        <td class=verd9 align=center>
        <cfform action="adminmanage.cfm?shinid=#gl.shinid#" method="post">
        <input type="submit" value="Manage List" class="legal8">
        <input type="hidden" value="#gl.shinid#" name="shinid">
        </cfform>
        </td>
        </cfif>
        </tr>
        </table>

        </cfloop>
</td>
</tr>       
</cfoutput>
</table>

Any help appreciated...

4

2 回答 2

1

我测试了您的 JavaScript,它似乎在以下简化示例中运行良好:

<table cellpadding=2 cellspacing=2 align=center border=1>
    <tr>
        <td>
            <img src="http://placehold.it/50x25" border=0 alt="Show List" onclick="showElement('#typeid#')">
        </td>
        <td valign=middle class=verd10>#type.type#</td>
    </tr>
    <tr>
        <td colspan=2 id="#typeid#" style="display: none">The hidden content.</td>
    </tr>
</table>

<script>
    function showElement(layer) {
        var myLayer = document.getElementById(layer);
        if (myLayer.style.display == "none") {
            myLayer.style.display = "table-cell";
            myLayer.backgroundPosition = "top";
        } else {
            myLayer.style.display = "none";
        }
    }
</script>

见第一个演示:http: //jsfiddle.net/audetwebdesign/BPWR8/

我还按原样测试了您的 HTML/ColdFusion 片段,JavaScript 仍然有效。
参见第二个演示:http: //jsfiddle.net/audetwebdesign/xK6jv/

您确定您的 JavaScript 在页面中吗?

次要观点:您可能希望将 display 设置为table-cell而不是block.

于 2013-08-24T17:23:32.700 回答
0

啊啊啊啊

似乎它的编码方式低于我正在尝试做的事情......

我做了一个 CFABORT 和所有的工作......

在下面 - 我有一个日历功能 - 拉一个日期等插入新条目......

看起来可能是这样...

这里的几个人提出的编码应该可以工作......

谢谢 - 我的坏...

于 2013-08-25T00:03:42.260 回答