小编use*_*100的帖子

使用Handlebars.js迭代基本的"for"循环

我是Handlebars.js的新手,刚刚开始使用它.大多数示例都基于迭代对象.我想知道如何在基本的循环中使用把手.

例.

for(i=0 ; i<100 ; i++) {
   create li's with i as the value
}
Run Code Online (Sandbox Code Playgroud)

怎么能实现这一目标?

handlebars.js

75
推荐指数
5
解决办法
6万
查看次数

"严格标准:只应通过引用传递变量"错误

我试图在这里基于代码获得基于HTML的递归目录列表:

http://webdevel.blogspot.in/2008/06/recursive-directory-listing-php.html

代码运行正常,但它会引发一些错误:

严格标准:在第34行的C:\ xampp\htdocs\directory5.php中只能通过引用传递变量

严格标准:只应在第32行的C:\ xampp\htdocs\directory5.php中通过引用传递变量

严格标准:在第34行的C:\ xampp\htdocs\directory5.php中只能通过引用传递变量

以下是代码的摘录:

else
  {
   // the extension is after the last "."
   $extension = strtolower(array_pop(explode(".", $value)));   //Line 32

   // the file name is before the last "."
   $fileName = array_shift(explode(".", $value));  //Line 34

   // continue to next item if not one of the desired file types
   if(!in_array("*", $fileTypes) && !in_array($extension, $fileTypes)) continue;

   // add the list item
   $results[] = "<li class=\"file $extension\"><a href=\"".str_replace("\\", "/",     $directory)."/$value\">".$displayName($fileName, $extension)."</a></li>\n";
  }
Run Code Online (Sandbox Code Playgroud)

php

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

如何在中心对齐td元素

我创建了一个简单的表,并希望将td元素对齐在中心但是对齐:css中的中心似乎不起作用

.cTable td{
align:center;
}

<table border='1' id='mytable' class="cTable">
<tbody>
<tr><th>Claim ID</th><th>Status</th></tr> 
<tr><td align="center">22</td><td>333</td></tr>    
<tr><td>22</td><td>333</td></tr>
<tr><td>22</td><td>333</td></tr>
</tbody>
</table> 
Run Code Online (Sandbox Code Playgroud)

html css

24
推荐指数
3
解决办法
12万
查看次数

Safari字体重量问题,文字太粗体

当我应用font-weight:bold样式时,与其他浏览器相比,Safari中的字体外观过于大胆.我按照某些网站的建议尝试了下面的CSS,但它仍然是相同的.

text-shadow: #000000 0 0 0px;
Run Code Online (Sandbox Code Playgroud)

文本呈现的屏幕截图:


在此输入图像描述

苹果浏览器
在此输入图像描述

这是我的css声明:

p {

margin: 8px 5px 0 15px; 
color:#D8D2CE; 
font-size:11pt;  
letter-spacing:-1px; 
font-weight: bold;  
font-family: LektonRegular;  
}

@font-face {
font-family: 'LektonRegular';
src: url('myfonts/lekton-regular-webfont.eot');
src: url('myfonts/lekton-regular-webfont.eot?#iefix') format('embedded-opentype'),
     url('myfonts/lekton-regular-webfont.woff') format('woff'),
     url(myfonts/lekton-regular-webfont.ttf)  format('truetype'),
     url('myfonts/lekton-regular-webfont.svg#LektonRegular') format('svg');
font-weight: normal;
font-style: normal;

}
Run Code Online (Sandbox Code Playgroud)

怎么解决这个问题?

css safari css3

18
推荐指数
3
解决办法
4万
查看次数

当字段为空时,val()返回占位符值而不是IE8,9中的实际值

下面显示的占位符属性在firefox中工作正常,但如果在字段为时调用val(),则返回占位符值而不是文本中的实际值.

JSFiddle - http://jsfiddle.net/Jrfwr/2/

<input id="tlt" type="text" placeholder="Enter Title" />
Run Code Online (Sandbox Code Playgroud)

JSCode

function placeHolderFallBack() {
   if ("placeholder" in document.createElement("input")) {
       return;
   }
   else {
       $('[placeholder]').focus(function () {
           var input = $(this);
           if (input.val() == input.attr('placeholder')) {
               input.val('');
               input.removeClass('placeholder');
           }
       }).blur(function () {
           var input = $(this);
           if (input.val() == '' || input.val() == input.attr('placeholder')) {
               input.addClass('placeholder');
               input.val(input.attr('placeholder'));
           }
       }).blur();
       $('[placeholder]').parents('form').submit(function () {
           $(this).find('[placeholder]').each(function () {
               var input = $(this);
               if (input.val() == input.attr('placeholder')) {
                   input.val('');
               }
           })
       });
   } …
Run Code Online (Sandbox Code Playgroud)

javascript jquery

18
推荐指数
1
解决办法
2万
查看次数

如何从json对象中删除$ promise和$ resolved

我在angular中使用$ resource来获取json对象,其结构定义如下

[
    {
        "id": 0,
        "name": "Type1"
    },
    {
        "id": 1,
        "name": "Type 2"
    }
]
Run Code Online (Sandbox Code Playgroud)

获取数据后... console.log(jsonObject)给了我

[Resource, Resource, $promise: Object, $resolved: true]
Run Code Online (Sandbox Code Playgroud)

如何从结果对象中删除$ promise和$ resolved?我尝试了angular.fromJson(json),但我仍然看到这些对象仍然存在.

javascript angularjs

17
推荐指数
2
解决办法
1万
查看次数

psql.exe - 密码验证在Windows中失败

我是PostgreSQL中的菜鸟.我在windows7上安装了ver 9.2.在安装过程中它要求输入密码并输入密码.现在,每当我运行d:\ tools\PostgreSQL9.2\bin\psql.exe时,它都会要求输入密码.当我输入密码时,它不接受,并显示"用户密码验证失败"user1".我已经重新安装了两次.我也尝试输入我的系统密码.

我正试图让下面的命令工作

psql.exe -f db/codedb.sql development
Run Code Online (Sandbox Code Playgroud)

我该怎么做才能让这个工作?

postgresql

16
推荐指数
2
解决办法
4万
查看次数

当长度为0时,ng-minlength有效

我是角色的新手,偶然发现了表单中的验证问题.下面是我的输入字段,当我没有输入任何值时,它显示为有效,并且即使我已将minlength定义为5,也会添加'ng-valid'类

<input id="name" type="text" placeholder="Name" ng-model="formdata.name" ng-minlength=5 />
Run Code Online (Sandbox Code Playgroud)

甚至在角度例子中也会发生这种情况 - http://docs.angularjs.org/api/ng.directive:input

我该如何解决这个问题?

angularjs

15
推荐指数
1
解决办法
1万
查看次数

当ng-model为null时,在select中设置默认值

我是角度新手,我正试图设置一个默认状态,以便在我的ng-model为空时选择.基本上我想在模型为空时将其设置为"无".我尝试了下面的代码,但它不起作用.

<select ng-init="item.carType | item.carType='none'" ng-model="item.carType">
    <option value="none">None</option>
    <option value="manual">Manual</option>
    <option value="auto">Auto</option>                      
</select>
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

15
推荐指数
1
解决办法
5万
查看次数

使用moment.js验证ISO 8601日期

我正在尝试使用moment.js在javascript中验证ISO 8601日期

console.log(moment("2011-10-10T14:48:00", "YYYY-MM-DD", true).isValid())
Run Code Online (Sandbox Code Playgroud)

它返回false.我哪里错了?日期类型格式不正确吗?

版本:时刻2.5.1

javascript momentjs

13
推荐指数
3
解决办法
1万
查看次数

标签 统计

javascript ×4

angularjs ×3

css ×2

css3 ×1

handlebars.js ×1

html ×1

jquery ×1

momentjs ×1

php ×1

postgresql ×1

safari ×1