我有一个问题.我有两个不同的主div元素与相同的子div元素.
当我想得到像这样的表
table = document.getElementById('list_table');
Run Code Online (Sandbox Code Playgroud)
这是给我第一个div表数据,但我想要第二个div表信息.
任何人都可以帮我这个.我无法更改ID名称.
谢谢
<div id="container_1">
<div id="my_table">
<table id = "list_table">
</table
</div>
</div>
<div id="container_2">
<div id="my_table">
<table id = "list_table">
</table
</div>
</div>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用更新查询,但它显示以下语法错误:
"MySql.Data.MySqlClient.MySqlException:'您的SQL语法有错误;请查看与您的MariaDB服务器版本对应的手册,以便在'[Item Name] ='bulb'附近使用正确的语法,[数量类型] ='pcs',[数量] ='470',[项目价格(以卢比计算)] ='在第1行''
using (MySqlConnection connection = new MySqlConnection(con))
{
try
{
connection.Open();
using (MySqlCommand command = connection.CreateCommand())
{
command.CommandText = "UPDATE inventory Set [Item Name]=@itname,[Quantity Type]=@qtype,[Quantity]=@qty,[Item Price (in Rs.)]=@itprice,[Supplier]=@supl WHERE [pid]=@lpid";
command.Parameters.AddWithValue("@lpid", lbl_dpid.Text);
command.Parameters.AddWithValue("@itname", txtbox_itemname.Text);
command.Parameters.AddWithValue("@qtype", cmbox_qtype.Text);
command.Parameters.AddWithValue("@qty", txtbox_qty.Text);
command.Parameters.AddWithValue("@itprice", txtbox_itprice.Text.ToString());
command.Parameters.AddWithValue("@supl", txtbox_supplier.Text);
DialogResult result = MessageBox.Show("Do You Want to Update?", "Update", MessageBoxButtons.OKCancel, MessageBoxIcon.Information);
if (result.Equals(DialogResult.OK))
{
command.ExecuteNonQuery();
connection.Close();
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Run Code Online (Sandbox Code Playgroud)
在数据库表中,pid的数据类型,项目价格(以卢比为单位)和数量为int,其余为varchar. 这就是设计的样子
我有一个隐式转换的类string定义为:
class TestClass : ITestInterface
{
public static implicit operator TestClass(string value)
{
return new TestClass(value);
}
public TestClass(string value)
{
Value = value;
}
public string Value { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
它实现了一个标记界面:
public interface ITestInterface { }
Run Code Online (Sandbox Code Playgroud)
我有另一个类的方法定义为:
public void DoSomething(ITestInterface thing) { }
Run Code Online (Sandbox Code Playgroud)
我试图调用该方法时遇到错误:
public void Test()
{
TestClass a = "This works fine.";
DoSomething("Why doesn't this work?");
}
Run Code Online (Sandbox Code Playgroud)
无法从'string'转换为'Tests.ITestInterface'
所有代码都大大简化了; 我的实际需求要复杂得多,但这似乎是阻碍我想实现的模式的核心.
什么阻止这种工作?(C#规范中的东西?)
我可以对我的代码进行任何更改以允许这种类型的转换工作吗?
我认为这应该有效:
$("#manual").css("color","red").fadeIn(400).fadeOut(150).fadeIn(150).fadeOut(150).fadeIn(150).css("color","black");Run Code Online (Sandbox Code Playgroud)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="manual">
some text here
</div>Run Code Online (Sandbox Code Playgroud)
我希望它是红色然后是黑色,但它没有这样做,为什么?
灵感来自这个问题:
在给定的例子中,我决定测试是否reduce比filterplus 更快map.
我做了一个小提琴:
var data = Array(10 ** 4).fill(null).map((_, i) => {
return {
checked: Math.random() < 0.5,
val: Math.floor(Math.random() * 10000)
}
})
f1 = () => {
t0 = performance.now();
data.filter(el => el.checked).map(el => el.val)
t1 = performance.now();
// console.log("filter plus map took " + (t1 - t0) + " milliseconds.")
document.getElementById('filterPlusMap').innerText = t1 - t0;
}
f2 = () => {
t0 = performance.now();
data.reduce((prev, curr) => { …Run Code Online (Sandbox Code Playgroud)假设我在页面上有一堆链接,例如:
<a class="eg-vimeo1-element-0 eg-post-14" href="http://255972693" target="_self"><i class="eg-icon-play"></i></a>
Run Code Online (Sandbox Code Playgroud)
我想每一个改变http://255972693以https://vimeo.com/video/255972693
我试着看看我的hrefs:
let e = document.getElementsByClassName("eg-vimeo1-element-0");
for (var i = 0; i < e.length; i++){
console.log(e[i].href);
console.log(e[i].href.replace("http://", "https://vimeo.com/video"));
}Run Code Online (Sandbox Code Playgroud)
<a class="eg-vimeo1-element-0 eg-post-14" href="http://255972693" target="_self"><i class="eg-icon-play"></i></a>Run Code Online (Sandbox Code Playgroud)
但它将href转换为IP并给出结果
http://vimeo.com/video/15.65.213.85/
Run Code Online (Sandbox Code Playgroud) 我目前使用ServiceBusTrigger绑定具有azure函数
[ServiceBusTrigger("%TopicName%", "%SubscripionName%", Connection = "MyConnection")]
string catclogueEventMsgs, ILogger log, ExecutionContext context)
Run Code Online (Sandbox Code Playgroud)
使用此local.settings.json文件
"Values": {
…
"MyConnection": "Endpoint=sb://testxxxxxxxxxxxxxxxxxx
"SubscriptionName": "testsubscriptionName"
"TopicName": "testtopicName",
}
Run Code Online (Sandbox Code Playgroud)
我如何在appsettings.json文件中表示这一点。会像下面吗?
"Values": {
"MyConnection": "Endpoint=sb://testxxxxxxxxxxxxxxxxxx
"SubscriptionName": "testsubscriptionName"
"TopicName": "testtopicName",
}
Run Code Online (Sandbox Code Playgroud)
我可以使用“ MySubs”对象代替如下的“ Values”对象吗?
"MySubs": {
"MyConnection": "Endpoint=sb://testxxxxxxxxxxxxxxxxxx
"SubscriptionName": "testsubscriptionName"
"TopicName": "testtopicName",
}
Run Code Online (Sandbox Code Playgroud)
如果可以使用上面的设置,如何在ServiceBusTrigger绑定中表示呢?我会改成这个吗?
[ServiceBusTrigger("%MySubs.TopicName%", "%MySubs.SubscripionName%", Connection = "MySubs.MyConnection")]
string catclogueEventMsgs, ILogger log, ExecutionContext context)
Run Code Online (Sandbox Code Playgroud) 我正在尝试输入我的请求的返回,但是我收到以下错误:
“Observable”类型不能分配给“Observable”类型。类型 'ArrayBuffer' 缺少类型 'AccountModel[]' 中的以下属性:length、pop、push、concat 等 25 个
我的要求如下:
getAccounts(): Observable<AccountModel[]>
{
return this.http.get(`${this._configShared.getApiUrl()}`, this.httpOptions);
}
Run Code Online (Sandbox Code Playgroud)
我哪里错了?
提前致谢...
我执行了以下操作,但它也不起作用:
getAccounts(): Observable<AccountModel[]>
{
return this.http.get<AccountModel[]>(`${this._configShared.getApiUrl()}`, this.httpOptions);
}
Run Code Online (Sandbox Code Playgroud)
错误:
类型 'Observable>' 不可分配给类型 'Observable'。类型“HttpEvent”不可分配给类型“AccountModel[]”。“HttpSentEvent”类型缺少“AccountModel[]”类型中的以下属性:length、pop、push、concat 等 26 个。
我正在尝试将一些数字添加到表中。看起来不错,但是当表格单元格为空时,它不起作用,则返回NaN。
我以为isNaN()可以将空字符串转换为数字。
isNaN(x) ? 0 : parseFloat(x);
Run Code Online (Sandbox Code Playgroud)
这是完整的代码:
isNaN(x) ? 0 : parseFloat(x);
Run Code Online (Sandbox Code Playgroud)
var cls = document.getElementById("res").getElementsByTagName("td");
var sum = 0;
for (var i = 0; i < cls.length; i++){
if(cls[i].className == "countable"){
sum += isNaN(cls[i].innerHTML) ? 0 : parseFloat(cls[i].innerHTML);
}
}
document.getElementById("sum").innerHTML=sumRun Code Online (Sandbox Code Playgroud)
我想在提交之前检查打字稿类型,所以我使用tsc --noEmit $(changedFile). 但是,该命令不能指定config文件。
我找到了--project选项,但是这个选项会检查整个项目,我只想检查changedFile,因为有些old files有类型错误但不需要处理。
那么我怎样才能changedFile在提交之前只检查类型呢?
javascript ×5
c# ×3
angular ×1
azure ×1
ecmascript-6 ×1
git ×1
html ×1
http ×1
id ×1
jquery ×1
mysql ×1
request ×1
sql ×1
typescript ×1