我没有编写这段代码,而且我无法弄清楚为什么我在第一时间得到以下错误e.preventDefault().我已经尝试在.click事件处理程序中移动代码,传递给它function(e){},替换它return false,声明它var e = $(this.href)(不要笑,我正在努力学习),我已经检查了返回的值a href,它是返回正确的hash.视频播放,但是当我运行IE调试器时,我收到此错误.有人请告诉我如何正确调试和修复此问题.谢谢

HTML
<a href="#video1" class="blueBtn modal" style="width:150px;"><span>Watch Video <img width="10" height="17" src="images/bluebtn.png"></span></a></div>
Run Code Online (Sandbox Code Playgroud)
使用Javascript
// FANCY BOX
$("a.modal").click(function(){
var inline=$(this).attr('href');
$.fancybox({
'transitionIn' : 'none',
'transitionOut' : 'none',
'href' : inline,
'onComplete' : function(){
$(inline+' .flowPlayer').videoPlayer();
$.fancybox.center(true);
},
'onClosed' : function(){loc();}
});
e.preventDefault();
});
$(".print").click(function(e){
window.open("print-docs/"+$(this).parent().attr('id')+".html","print","width=1,height=1");
e.preventDefault();
});
function loc(){
var location=window.location.href;
var replaceHash=location.replace(document.location.hash,"");
window.location.assign(replaceHash);
}
Run Code Online (Sandbox Code Playgroud) 我需要一个可以模拟C++ for语句的函数.我想要一些东西,我可以给出一个起点,一个结束和另一个变量,它将说明一次增加多少.
例如,如果我告诉它开始10,结束1并一次增加2,它将生成10, 8, 6, 4, 2.
我正在尝试将整数转换为字符串,然后使用XOR加密对字符串进行加密.但是当我再次解密我的Strin时,我得到了一个不同的答案,即我在加密之前输入的字符串,我不知道我做错了什么?
public class Krypte {
public static void main (String [] args) {
int i = 12345;
String k = Integer.toString(i);
String G = secure(k.getBytes());
System.out.println("Encrypted: " + G);
String U = secure(G.getBytes());
System.out.println("Decrypted: " + U);
int X = Integer.parseInt(U);
System.out.println("As an int: " + X);
}
public static String secure(byte[] msg) {
// Variables
int outLength = msg.length;
byte secret = (byte) 0xAC; // same as 10101100b (Key)
// XOR kryptering
for (int i = 0; i < …Run Code Online (Sandbox Code Playgroud) 我现在有这个代码,它获取日期和时间.我想创建一种带编号的索引,因为我在一个foreach循环中返回了大约10个日期和时间.它在一个函数中,我需要返回此数组以在其他地方执行某些操作.
$i = 0;
foreach ($data as $key =>$value) {
$new_data = array (
$i => array (
"date"=> $value->DATE,
"time"=> $value->TIME,
)
);
$i++;
}
Run Code Online (Sandbox Code Playgroud)
我希望它看起来更像这样
Array (
[0] => Array (
[date] => whatever date
[time] => whatever time
)
[1] => Array (
[date] => whatever date
[time] => whatever time
)
[2] .. etc
)
Run Code Online (Sandbox Code Playgroud)
事实证明,这不是我得到的.我明白了
Array (
[10] => Array (
[date] => whatever date
[time] => whatever time
)
Run Code Online (Sandbox Code Playgroud)
它只打印在一个/只给我十分之一.我如何让它继续使用$ i变量来允许我在编号索引中获取它?为什么它只向我显示第十个?
这两个中哪个更好?
<span translate="key">Key</span>
Run Code Online (Sandbox Code Playgroud)
要么
<span>{{'key' | translate}}</span>
Run Code Online (Sandbox Code Playgroud)
它们既好又可以正常工作,但在第一种情况下,我必须填写元素的内容。
所以我一直在用我认为正确的BEM编写我的 classNames 。像这样的东西:
<div className="article">
<div className="article__textbox">
<h1 className="article__textbox--heading"></h1>
<p className="article__textbox--subheading"></p>
<span className="article__textbox--author"></span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
看看我是如何拥有文本框的,然后我在里面的所有内容都给出了 2 个破折号?我最近发现这是无效的 BEM,现在我需要知道应该如何命名嵌套的东西。例如,我应该为标签命名什么<p>?
美好的一天,
我在Perl中有一个简单的工作例程,可以交换两个单词:
即John Doe -----> Doe John
这里是:
sub SwapTokens()
{
my ($currentToken) = @_;
$currentToken =~ s/([A-Za-z]+) ([A-Za-z]+)/$2 $1/;
# $currentToken =~ s/(\u\L) (\u\L)/$2 $1/;
return $currentToken;
}
Run Code Online (Sandbox Code Playgroud)
以下用法完全符合我的要求:
print &SwapTokens("John Doe");
Run Code Online (Sandbox Code Playgroud)
但当我取消注释'$ currentToken = ~s /(\ u\L)(\ u\L)/ $ 2 $ 1 /;
我收到一个错误.我错过了什么,看起来我的语法是正确的.
TIA,
COSON
我创建了一个简单的mysql查询,以便在用户上传文件时运行.该查询旨在在表格中创建一个新行,并将该文件的名称附加到标题为file_name的列.但是,phpmyadmin告诉我,当我在SQL部分运行查询时,我无法这样做,因为它给了我这个错误.
#1054 - Unknown column 'name' in 'field list'
这是我的查询代码.我怀疑这是一个语法错误.
INSERT INTO `dress` (file_name) VALUES (name)
Run Code Online (Sandbox Code Playgroud)
另外,这是我的数据库信息
dress CREATE TABLE `dress` (
`primary_id` int(11) NOT NULL AUTO_INCREMENT,
`file_name` varchar(50) NOT NULL,
`match_1` varchar(100) NOT NULL,
PRIMARY KEY (`primary_id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1
Run Code Online (Sandbox Code Playgroud) 为什么我不能用这个for循环追加多个块?
var di = document.createElement("div");
di.className = 'box';
di.style.width = '100px';
di.style.height = '100px';
for (var i = 0; i < 5; i++) {
document.body.appendChild(di);
}
Run Code Online (Sandbox Code Playgroud)
然而,这个有效:
for (var i = 0; i < 5; i++) {
var di = 'di' + [i],
di = document.createElement("div");
di.className = 'box';
di.style.width = '100px';
di.style.height = '100px';
document.body.appendChild(di);
}
Run Code Online (Sandbox Code Playgroud)
但为什么第一个不起作用?
I have a list of checkboxes while selecting checkboxes i have to add the values to arrays and while unchecking i have to remove that from array.
following code am using. but it is not deleting while unchecking
<tr><td class="tdstyleSelect"><input type="checkbox" name="joblist" onclick="toNfroVmps(this.id);" id="' + i + '" checked>
var toNfroVmps = function(id) {
if($('#' + id).is(':checked'))
elementIds.push(id);
else
delete elementIds[elementIds.indexOf(id)]
}
Run Code Online (Sandbox Code Playgroud)