我只是通过PHP的教程,我发现我们可以使用<script language="php"></script>标签编写我们的PHP代码,我试图找出这个和<?php ?>标签之间的区别和优点或缺点,但没有找到任何东西,任何人都可以告诉请与我区别.
提前致谢.
我正在使用此无限滚动库及其在滚动我的代码时多次调用功能:
<table class="table table-striped table-hover inline-edit"
infinite-scroll
[infiniteScrollDistance]="2"
[infiniteScrollThrottle]="10"
(scrolled)="onScrollDown()">
onScrollDown() {
this.pageNumber += 1;
this.getContacts();
}
Run Code Online (Sandbox Code Playgroud)
当达到视口长度时,它将多次调用onScrollDown,例如5/6次
我想知道找出包含任何css样式的元素的检查过程.
我有以下HTML代码:
<ul id="sample">
<li style="left:-100px">text 1</li>
<li style="left:0px">text 2</li>
<li style="left:100px">text 3</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我想找出剩下的样式是0px的"li",然后想要再应用那个样式.
谢谢
我想要正则表达式,通过忽略空格,加上(+),括号和破折号,找出最多12位长数字,例如:
Primary contact number +91 98333332343 call me on this
My number is +91-983 333 32343
2nd number +1 (983) 333 32343, call me
Another one 983-333-32343
One more +91(983)-333-32343 that's all
121 street pin code 421 728 & number is 9833636363
Run Code Online (Sandbox Code Playgroud)
目前,我有一个正则表达式,它负责从字符串中获取联系人号码:
/* This only work for the first case not for any other
and for last one it outputs "121" */
\\+?\\(?\\d*\\)? ?\\(?\\d+\\)?\\d*([\\s./-]?\\d{2,})+
Run Code Online (Sandbox Code Playgroud)
那么在这里可以做些什么来支持所有上述情况,简而言之,忽略特殊字符和长度应该在10-12之间.
当我进行构建时,我收到这个奇怪的错误,在监视或运行服务器时它没有给出任何内容,仅在构建时给出此错误:
Unexpected closing tag "a". It may happen when the tag has already been closed by another tag. For more info see https://www.w3.org/TR/html5/syntax.html#closing-elements-that-have-implied-end-tags ("ref=/user><img class="d-inline-block align-top" [src]="staticUrl + 'v4/img/intouch-logo-name.png'"/>[ERROR ->]</a> <search class="mr-auto col-sm-7 col-md-6 col-lg-5 col-xl-5 p-0"></search> <div id=settings> <div"): ng:///Users/header.html@0:192
这是我的 html:
<nav class="navbar d-flex flex-row navbar-light bg-faded fixed-top">
<a class="navbar-brand" href="/user"><img class="d-inline-block align-top" [src]="staticUrl + 'v4/img/intouch-logo-name.png'" /></a>
<search class="mr-auto col-sm-7 col-md-6 col-lg-5 col-xl-5 p-0"></search>
<div id="settings">
<div class="dropdown clearfix">
<div class="userProfile dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<div class="userDetail">
<label> …Run Code Online (Sandbox Code Playgroud) 我正在使用每个函数来检查是否选中了网格中的特定复选框,我正在使用angular 2,下面是我的代码:
// Typescript code
this.toggle = this.contactlist.every(item => item.checked);
// JS output is
this.toggle = this.contactlist.every(function(item) {
return item.checked;
});
Run Code Online (Sandbox Code Playgroud)
现在,我想在每个函数中包含更多代码,因此我尝试了以下操作:
this.toggle = this.contactlist.every(item => {
item.checked;
console.log('Item:', item)
});
// In Webpack it gives me this error
Argument of type '(item: any) => void' is not assignable to parameter of type '(value: any, index: number, array: any[]) => boolean'.
Type 'void' is not assignable to type 'boolean'.
Run Code Online (Sandbox Code Playgroud)
我该如何解决?
我找不到从 URL 读取图像并使用 JavaScript/Ajax 上传的正确方法。
假设有一个 URL: https://pbs.twimg.com/profile_images/1580483969/parisjs_transparent.png。
我现在应该可以上传它,但我想先上传我需要下载它,那么程序是什么?
我试图包含.scss文件,它总是抛出这个错误:
Expected 'styles' to be an array of string
以前当我使用webpack 1时,一切都运行正常,我尝试了3种不同的方式,但是没有一种方法可以在这里完成:
1. styles: [require('../../../static/v4/angular/scss/main.scss')]
2. styles: [String(require('../../../static/v4/angular/scss/main.scss'))]
1. styles: [require('../../../static/v4/angular/scss/main.scss').toString()]
Run Code Online (Sandbox Code Playgroud)
这是我的装载机:
{
test: /\.css$/,
exclude: helpers.root('src', 'app'),
loader: ExtractTextPlugin.extract({fallback: 'style-loader', loader: 'css-loader'})
},
{
test: /\.css$/,
include: helpers.root('src', 'app'),
use: [{loader: 'raw-loader'}]
}, {
test: /\.scss$/,
exclude: /node_modules/,
use: [{
loader: "to-string-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "sass-loader" // compiles Sass to CSS
}]
}, {
Run Code Online (Sandbox Code Playgroud) 我有ul li list并且我想在点击"li"元素时触发jQuery click事件,但第一个li/first-child除外.假设我有以下列表:
<script type="text/javascript">
$(document).ready(function(){
$(".sample_list li").click(function(){
alert("hello");
});
});
</script>
<ul class="sample_list">
<li>First Child</li>
<li>Second Child</li>
<li>Third Child</li>
<li>Fourth Child</li>
</ul>
Run Code Online (Sandbox Code Playgroud)
现在,当我点击除第一个之外的其他li时,我应该得到警告框.我想我必须在这个$(".sample_list li")中写一些东西,比如$(".sample_list li:other-child"),但不确定.请帮忙
提前致谢
我有4张卡片,我想在点击时更改其元素的文本,下面是我的html:
<tr>
<td class="card">down</td>
<td class="card">down</td>
</tr>
<tr>
<td class="card">down</td>
<td class="card">down</td>
</tr>
Run Code Online (Sandbox Code Playgroud)
因此,如果我点击任何卡片,它的文字应该是正常的,其他卡片应该是关闭的.我能够更改点击卡的文本,但我如何将其他卡值更改为关闭?下面是我的JS
var cards = document.getElementsByClassName('card');
for (var i = 0; i < cards.length; i++) {
cards[i].onclick = function(target) {
this.innerHTML = 'up';
}
}
Run Code Online (Sandbox Code Playgroud) angular ×4
javascript ×4
jquery ×3
webpack ×2
angular2-aot ×1
angularjs ×1
php ×1
regex ×1
typescript ×1
webpack-2 ×1