小编ajH*_*man的帖子

node.js Date#getTime() 有什么作用?

我现在正在研究 learnyounode 模块 13。在提示部分,它声称“Date#getTime() 也会派上用场。”

我查找了 Date 对象并找到了 getTime 方法,但是当有一个散列而不是一个句点时,这意味着什么?

javascript gettime node.js

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

jQuery:click()不处理由jQuery添加的元素

我使用Bootstrap和jQuery创建了一个待办事项列表.通过单击每个列表项右侧的"X"徽章,可以从列表中删除项目.这适用于首次加载时页面上的项目,但您无法删除用户添加的项目.

也许需要刷新某些东西以提醒脚本应该监视click事件的新元素?

http://jsfiddle.net/pcx5mvh7/

todo.js:

$(document).ready(function() {
    //add item if the button is clicked
    $('#addButton').click(function(){
        $('<li class="list-group-item"><span class="badge">X</span>' + $('#input').val() + '</li>').appendTo('#list');
        $('#input').val(null);
    });

    //add item if the enter key is pressed
    $('#input').bind("enterKey",function(e){
        $('<li class="list-group-item"><span class="badge">X</span>' + $('#input').val() + '</li>').appendTo('#list');
        $('#input').val(null);
    });

    $('#input').keyup(function(e){
        if(e.keyCode == 13) {
            $(this).trigger("enterKey");
        }
    });

    //remove an item by clicking the badge
    $('.badge').click(function() {
        $(this).parent().remove();
    });
});
Run Code Online (Sandbox Code Playgroud)

index.html的:

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>To Do List</title>
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
    <script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="todo.js"></script> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery twitter-bootstrap

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

为什么我的javascript文件没有链接?

这是我第一次尝试让我的jQuery代码在codeacademy.com以外的地方工作,所以请耐心等待.

我有三个文件,index.html,stylesheet.css和script.js(加上几张图片)都在同一个文件夹中.index.html和style.css相互配合得很好,但是无论我放入什么内容,script.js似乎根本不想采取任何效果(使用命令就像在$上隐藏段落一样简单(文档) ).准备...

这是index.html:

<!DOCTYPE HTML>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
    <script type='text/javascript' src='script.js'></script>
</head>

<body>
<p>test test test</p>
<div class="mainh1">
    <h1 id="header1">Hi I'm <a href="mailto:redacted@gmail.com" id="email">James</a></h1>
    <h1 id="header2">I live in <a href="www.seattle.gov" id="city">Seattle</a></h1>
    <h1 id="header3">I like <a href="www.makerhaus.com" id="tinker">tinkering</a></h1>
    <h1 id="header4">and I <em>really</em> like <a href="www.analogcoffee.com" id="coffee">coffee</a></h1>
</div>

<div class="image">
    <img src="james.jpg"/>
</div>

<div class="navbar">
</div>

</body>
</html>
Run Code Online (Sandbox Code Playgroud)

这是stylesheet.css:

a {
    text-decoration:none;
}

body {
    background-image: url("debut_light.png");
}
.mainh1 {
    text-align: left;
    font-family: 'Cantora One', sans-serif;
    color: …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

-1
推荐指数
1
解决办法
743
查看次数

标签 统计

javascript ×3

jquery ×2

gettime ×1

html ×1

node.js ×1

twitter-bootstrap ×1