小编dbi*_*ott的帖子

"变量初始化程序多余"究竟是什么意思?

所以我使用Webstorm IDE来获取一些JavaScript,我相信它使用JSLint来检查代码.我有一堆variable initializer is redundant警告.就我需要解决的问题而言,我找不到任何关于它究竟意味着什么的东西.

例:

function calcPayNow(){
    var payNowVal = 0;
    --snip---
    payNowVal = (Math.round(tec * x) - Math.round(allpmts * x)) / x;
   --snip--
}
Run Code Online (Sandbox Code Playgroud)

javascript

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

从另一个div顶部的div获取点击事件

UI 部分如下所示

在此输入图像描述

我的垃圾桶在点击时工作正常,但那时我不需要在蓝色 div 上有点击事件。现在我在蓝色 div 上也有一个单击事件,当我单击垃圾桶时,我得到的是蓝色 div 对象而不是垃圾桶对象。我尝试了一些 z-index 技巧,但没有用。

任何帮助表示赞赏。

<td id="ea-13" class="activityTableCell">
    <div style="width:90px; margin-left:0px" class="eventTimeSpan"></div>
    <div id="NewActivityContainer-13" class="activityContainerExisting">
        <div data-uid="57386445" class="label label-sm label-info newActivityClass point" style="width:59px; top:-1px; left:30px; z-index:4000" title="Mobile Game Party">
        Mobile Game Party 
            <div data-isactivity="1" data-packageid="" data-elid="57386445" class="xRemove" style="left:46px;z-index:8000"><i class="fa fa-trash font-red" title="Remove"></i>
            </div>
        </div>
    </div>
</td>
Run Code Online (Sandbox Code Playgroud)

点击代码:

$(document).on("click", ".newActivityClass", function(){
    console.log(this);
    ...snip...
}

$(document).on("click", ".xRemove,.aRemove", function(){
...snip...
}
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

有没有更好的方法来做到这一点?

我的SQL有点生疏,如果有更好的方法来做这个WHERE子句,我只是好奇吗?假设有一种方法,我确信它有.它的运行速度非常快,但我只是不喜欢它,并想知道它是否可以改进.

SELECT DISTINCT p.firstname              ,
            p.middlename             ,
            p.lastname               ,
            p.gender                 ,
            p.dob                    ,
            p.id      AS patientid   ,
            pr.id     AS practiceid  ,
            pr.[name] AS practicename,
            pr.parentaco             ,
            pp.encounterdate
FROM            ((aco.patients_practices patients_practices
            LEFT OUTER JOIN aco.patients p
            ON              (
                             patients_practices.patientid = p.id
                            )
            )
            LEFT OUTER JOIN aco.practices pr
            ON              (
                             patients_practices.practiceid = pr.id
                            )
            )
            INNER JOIN aco.patientpreferences pp
            ON              (
                             pp.patientid = p.id
                            )
WHERE           (
                            pr.parentaco =
                            (SELECT parentaco
                            FROM    aco.practices
                            WHERE   master_companyid = 763
                            )
            OR              pr.id = …
Run Code Online (Sandbox Code Playgroud)

t-sql sql-server

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

在Javascript循环中没有得到正确的结果

我正在使用带有Octonode(GIThub插件)的Node.js 来获取我使用的一些插件的最新标签.我得到了大部分工作,但循环让我循环.

里面client.get()iVAR是回来为2,只是标注插件.到JSON对象中的最后一项.

这可能是一些愚蠢的事情,但我无法弄清楚是什么.

任何帮助赞赏.

这是我到目前为止所拥有的.

var github = require('octonode');
var client = github.client();


var mydata = {plugins:[
            {user:'RobinHerbots',repo:'jquery.inputmask',name:'jQuery-InputMask',myversion:'3.1.26'},
            {user:'getify',repo:'LABjs',name:'LAB.js',myversion:'2.0.3'}
         ]};

for (var i = 0; i < mydata.plugins.length; i++) {
 var plugin = mydata.plugins[i];
    client.get("/repos/"+plugin.user+"/"+plugin.repo+"/tags", {}, function(err, status, body, headers){
    console.log(i);
        if(status === 200) {
            var ghresult = body[0]; 
            //console.log(plugin.name+" current version: "+ ghresult.name +" :: My Version: "+ plugin.myversion);
            console.log(ghresult.name,i);
        } else {
            console.log(err);
        }
    });     
}
Run Code Online (Sandbox Code Playgroud)

javascript json node.js

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

标签 统计

javascript ×3

css ×1

html ×1

jquery ×1

json ×1

node.js ×1

sql-server ×1

t-sql ×1