小编Neo*_*nig的帖子

JQuery if/else语句匹配通配符CSS名称

我正在尝试在JQuery中编写一个if/else语句,它可以通过匹配'IN'或'OUT'(在本例中)来改变元素的类.

例如,我有几个<DIV>class='IN-something'OR class='OUT-something'.

如果我知道确切的CSS类,下面的方法会有效,但我知道它包含'IN'或'OUT'.

所以像这样:

if ($(jRow).hasClass('IN-*'))
{jRow.attr( "class", "OUT-foo" );}
else  
{jRow.attr( "class", "IN-foo");}
Run Code Online (Sandbox Code Playgroud)

想法?谢谢!

jquery if-statement class wildcard indexof

13
推荐指数
2
解决办法
6593
查看次数

在ColdFusion11中使用java类 - CreateObject函数的java对象类型是未知的

我有一些代码可以在Railo下运行,但我正试图让这个特定的应用程序在CF10和CF11上工作

这是一个cfWheels应用程序,我BCrypt.class/miscellaneous/目录中有一个文件.

在我的/events/onapplicationstart.cfm档案中,我有:

application.bCrypt = CreateObject( "java", "BCrypt", "/miscellaneous/" );
Run Code Online (Sandbox Code Playgroud)

这适用于Railo; 但在CF11中我得到了

The java object type is unknown for the CreateObject function.

Verify the type of your object when creating it and try again. 
Valid Types are : component | java | webservice | dotnet | com | corba | .NET


The error occurred in /Volumes/Documents/blah/public/events/onapplicationstart.cfm: line 8
Called from /Volumes/Documents/blah/public/wheels/global/cfml.cfm: line 111
Called from /Volumes/Documents/blah/public/wheels/events/onapplicationstart.cfm: line 388
6 : 
7 :     // BCrypt …
Run Code Online (Sandbox Code Playgroud)

coldfusion railo cfwheels coldfusion-10

6
推荐指数
1
解决办法
516
查看次数

如何在使用组时找到嵌套的cfoutput记录计数

考虑以下:

<cfoutput query="resources" group="type">
    <h4>#type#</h4>
       <cfoutput>
          #name#
       </cfoutput>
 </cfoutput>
Run Code Online (Sandbox Code Playgroud)

resources.recordcount会给我记录的总数,但有没有一种优雅的方法来查找嵌套数据的记录数?例如

<cfoutput query="resources" group="type">
    <h4>#type# (#noofrecords# of #resources.recordcount#)</h4>
       <cfoutput>
          #name#
       </cfoutput>
 </cfoutput>
Run Code Online (Sandbox Code Playgroud)

我可以用循环来做一些hacky,但是想知道是否有一种方法可以使用cfoutput组专门做到这一点.

coldfusion cfoutput coldfusion-10 cfloop

2
推荐指数
2
解决办法
2067
查看次数

从datepicker字符串创建DateTime(coldfusion)

在ColdFusion 10中:

我正在尝试从来自datepicker的字符串返回有效的日期时间字符串.

字符串格式为:

15 Aug 2014 - 12:47 PM
Run Code Online (Sandbox Code Playgroud)

我想最终得到:

{ts '2014-08-15 12:47:00'}
Run Code Online (Sandbox Code Playgroud)

我写了这个可怕的函数来获取字符串的每个部分并尝试createDateTime():

public function formatDateTimeFromPicker(required string thedate){
    var c={};
    var d=arguments.thedate;
        c.year=listGetAt(d, 3, " ");
        c.month=returnMonthAsNumber(listGetAt(d, 2, " "));
        c.day=listGetAt(d, 1, " ");
        c.time=listGetAt(d, 5, " ");
        c.hour=listGetAt(c.time, 1, ":");
        c.minute=listGetAt(c.time, 2, ":");
        c.tt=listGetAt(d, 6, " ");
        if(c.tt == "PM" AND c.hour NEQ 12){
            c.hour=(c.hour + 12);
        }
        return createDateTime(c.year, c.month, c.day, c.hour, c.minute, 00);
}

public function returnMonthAsNumber(required string monthstring){
    var months="Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec";
        return listFindNoCase(months, arguments.monthstring);
} …
Run Code Online (Sandbox Code Playgroud)

string coldfusion datetime date

0
推荐指数
1
解决办法
283
查看次数

如何在cfscript中复制此循环(用于cf10/railo)

我在标签格式中很好地工作,但我正在尝试将所有内容迁移到cfscript中.我怎么能这样做?(基本上,它从date1到date2循环,并且需要以15分钟为间隔.

<cfset from=now()>
<cfset to=dateadd("d", 1, from)>
<cfloop from="#from#" to="#to#" index="i" step="#CreateTimeSpan(0,0,15,0)#">
 ...stuff...
<cfloop>
Run Code Online (Sandbox Code Playgroud)

这是如何指定让我的步骤位...

coldfusion cfloop cfml

0
推荐指数
1
解决办法
170
查看次数