你好,这是我的 JavaScript 代码:
window.onload = function () {
function hideAds() {
setTimeout(hide, 2000);
}
function hide() {
var ads = document.querySelector(".ads");
ads.style.marginTop = (-ads.offsetHeight) + "px";
}
function reveal() {
ads.style.marginTop = "";
hideAds();
}
var ads = document.querySelector(".ads");
ads.addEventListener("click", reveal, true);
hideAds();
}
Run Code Online (Sandbox Code Playgroud)
从这段代码来看,除了“ads.addEventListener”倒数第二行之外,一切正常。是什么原因?我在这里做错了什么吗..?
我需要通过单击添加的广告类 div 来调用我的 Reveal 函数。
有人帮助我吗?
我得到的时间像13.40,但我需要将它转换为1.40 ..任何人都知道,这是最好的方法.我正在使用jquery来腾出时间.
我的代码是:
var time = new Date(myDate);
var hours = time.getHours();
alert(hours);
Run Code Online (Sandbox Code Playgroud) 在我的页面中,我在表单中没有复选框.因为我正在检查其中的一些,我需要过滤其余的复选框,并需要在那些上添加separet事件.我喜欢这样:
var userLocales = $('input[type="checkbox"]', "form").filter(function(){
return $(this).val() === value["name"]
}).prop("checked",true);
$(userLocales).click(function(){
$(this).parent().toggleClass("red");
})
$('input:checkbox:not("checked")', "form").not(userLocales).click(function(){
$(this).parent().addClass("green"); //this is not working.. it works even for not selected elements..
})
Run Code Online (Sandbox Code Playgroud)
但不工作..任何正确的方法来完成pelase ..?
我是AngularJS的新手.我需要知道如何使用它来处理这种情况.
我有一个包含值的数组.我正在使用ng-repeat迭代数组,它工作正常.我的要求是如何向用户点击的第一个子节点添加一个class(active),单击的元素应该获取类并从其余元素中删除该类.ulactive active li
我在JQuery中很容易就像这样:
$('li').addClass('active').siblings().removeClass('active')
Run Code Online (Sandbox Code Playgroud)
但是这里如何实现同样的目标呢?
我的代码:
JavaScript控制器
var myApp = angular.module("myApp", []);
myApp.controller("main", function ($scope) {
$scope.items = [1,2,3,4,5];
$scope.activate = function (item) {
//how to active this item?
//onload how to add class on first li?
}
})
Run Code Online (Sandbox Code Playgroud)
HTML
<ul>
<li ng-click="activate(item)" ng-repeat="item in items">
{{item}}
</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我正在config从 调用该文件server.js。当我调用该config文件时,我收到的错误为ReferenceError: bodyparser is not defined. 我不明白我的结局有什么问题。
有人帮我解决这个问题吗?
这是我的配置文件:
var
path = require('path'),
routes = require('./routes'),
exphbs = require('express-handlebars'),
express = require('express'),
bodyParser = require('body-parser'),
cookieParser = require('cookie-parser'),
morgan = require('morgan'),
methodOverride = require('method-override'),
errorHandler = require('errorhandler');
module.exports = function(app) {
app.use(morgan('dev'));
app.use(bodyParser({
uploadDir:path.join(__dirname, 'public/upload/temp')
}));
app.use(methodOverride());
app.use(cookieParser('some-secret-value-here'));
routes(app);
app.use('/public/', express.static(path.join(__dirname, '../public')));
if ('development' === app.get('env')) {
app.use(errorHandler());
}
return app;
};
Run Code Online (Sandbox Code Playgroud)
服务器.js:
var express = require('express'),
config = require('./server/configure'),
app = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用ngrx/store出错来开发应用程序。无法找出问题。有人帮我吗?
这是我的错误:
ERROR in src/app/store/effects/authentication.effects.ts(25,7): error TS2339: Property 'ofType' does not exist on type 'Actions<Action>'.
src/app/store/effects/authentication.effects.ts(29,59): error TS2339: Property 'email' does not exist on type '{}'.
src/app/store/effects/authentication.effects.ts(29,74): error TS2339: Property 'password' does not exist on type '{}'.
src/app/store/effects/authentication.effects.ts(33,73): error TS2339: Property 'email' does not exist on type '{}'.
Run Code Online (Sandbox Code Playgroud)
打字稿文件:
import { Injectable } from '@angular/core';
import { Action } from '@ngrx/store';
import { Router } from '@angular/router';
import { Actions, Effect, ofType } from '@ngrx/effects';
import { Observable, …Run Code Online (Sandbox Code Playgroud) 在我的复选框中,我正在使用选择元素使用值...为那(样本)我做这样的..
<form>
<input type="checkbox" value="one 234" />
</form>
function doit(){
var x = "one 234"
$(':checkbox[value='+x+']')
.css({border:"1px solid green"})
}
doit();
Run Code Online (Sandbox Code Playgroud)
但是不起作用..如果我删除"一个234"的值之间的空间 - 它的工作原理.如何处理这种情况..?
这是jsfiddle
在我安装的sublime文本中,由于我使用代理,我PyV8手动安装:
第一步:我打开了这条路:
C:\Users\*****\AppData\Roaming\Sublime Text 3\Packages
Run Code Online (Sandbox Code Playgroud)
step2:并创建了一个名为:PyV8和的文件夹
step3:我从以下网址下载了一个zip文件:https://github.com/emmetio/pyv8-binaries并再次创建了一个新文件夹而不是第2步pyv8-win64-p3
step4:我将从step3下载的文件夹解压缩到新创建的文件夹中pyv8-win64-p3(步骤3).
现在我重新启动了我的sublime3,但我仍然收到错误说:

任何人纠正我做错了什么?
我有许多 svg 组,每个组中都有许多子项。
如果发生这种情况,click我group想将我所有的团体和他们的孩子一起搬走。我想知道translate它的属性clicked组的属性,以便我可以移动其他组。
我试图获得该translate财产,但未能获得。
这是我尝试过的:
var svg = d3.select('body').append('svg').attr({width:300,height:300});
var group = svg.append('svg:g').attr({
'width':100,
'height':100,
'transform' : 'translate(50, 50)'
});
group.append('circle').attr({'r':30});
group.on('click', function () {
console.log(this); //how to get the translated properties?
});
Run Code Online (Sandbox Code Playgroud)
当我从库之一导入接口时出现上述错误:
import { DetailsProps } from '@vite/prop-types'; //error
import styles from './header.module.less';
const initailDetails: DetailsProps = {
name: 'Arif',
city: 'Chennai',
pin: 600019,
};
export function Header() {
return (
<div className={styles['container']}>
<h1>Welcome to Header!</h1>
<ul>
{Object.values(initailDetails).map((v) => (
<li key={v}>{v}</li>
))}
</ul>
</div>
);
}
Run Code Online (Sandbox Code Playgroud)
NX报告:
Node : 16.13.2
OS : darwin arm64
npm : 8.1.2
nx : 15.3.3
@nrwl/angular : Not Found
@nrwl/cypress : 15.3.3
@nrwl/detox : Not Found
@nrwl/devkit : 15.3.3
@nrwl/esbuild : Not Found
@nrwl/eslint-plugin-nx : …Run Code Online (Sandbox Code Playgroud) jquery ×4
javascript ×3
angular7 ×1
angularjs ×1
d3.js ×1
datetime ×1
debugging ×1
emmet ×1
express ×1
filter ×1
ngrx ×1
ngrx-effects ×1
ngrx-store ×1
node.js ×1
nomachine-nx ×1
nx-workspace ×1
rxjs6 ×1
sublimetext3 ×1
svg ×1