首页 \ 问答 \ 如何使用这个JavaScript(How to use this JavaScript)

如何使用这个JavaScript(How to use this JavaScript)

目前我面临一个实现Javascript的问题。 链接在这里

http://jsfiddle.net/joplomacedo/WzA4y/

这是工作我正在使用Microsoft Visual Studio 2010,我有小文件一个是HTML,另一个是CSS,我使用Javscript如下面的代码,但这不像jsFiddle上面的链接。

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

 <script type="text/jscript" language="javascript">
    var body = $('body'),
    main = $('.main'),
    open_modal = $('.open-modal'),
    close_modal = $('.close-modal'),
    modal_container = $('.modal-container'),
    toggleModal = function() {
        body.toggleClass('body-locked');
        modal_container.toggleClass('dp-block');
    };

    open_modal.on('click', toggleModal);
    close_modal.on('click', toggleModal);

 </script>


</head>

<body>

<button class="open-modal">Button!</button>


<div class="modal-container dp-none">
    <div class="modal">
        <button class="close-modal">Close!</button>

    </div>
</div>

</body>
</html>

Currently I have face one issue implementing Javascript . Here is the Link

http://jsfiddle.net/joplomacedo/WzA4y/

This is working And I'm using Microsoft Visual Studio 2010 and I have small files One is html, and another is CSS, I use the Javscript like below code but this is not working as like in jsFiddle above link .

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" type="text/javascript"></script>

 <script type="text/jscript" language="javascript">
    var body = $('body'),
    main = $('.main'),
    open_modal = $('.open-modal'),
    close_modal = $('.close-modal'),
    modal_container = $('.modal-container'),
    toggleModal = function() {
        body.toggleClass('body-locked');
        modal_container.toggleClass('dp-block');
    };

    open_modal.on('click', toggleModal);
    close_modal.on('click', toggleModal);

 </script>


</head>

<body>

<button class="open-modal">Button!</button>


<div class="modal-container dp-none">
    <div class="modal">
        <button class="close-modal">Close!</button>

    </div>
</div>

</body>
</html>

原文:https://stackoverflow.com/questions/18463271
更新时间:2024-01-24 11:01

最满意答案

你不能使用Digest::SHA->sha256_hex(1)因为它实际上是Digest::SHA::sha256_hex("Digest::SHA", 1)

使用

 Digest::SHA::sha256_hex(1)

要么

 use Digest::SHA qw(sha256_hex);
 sha256_hex(1);

或(OOP式)

Digest::SHA->new(256)->add(1)->hexdigest()

You can't use Digest::SHA->sha256_hex(1) because it's actually Digest::SHA::sha256_hex("Digest::SHA", 1).

Use

 Digest::SHA::sha256_hex(1)

or

 use Digest::SHA qw(sha256_hex);
 sha256_hex(1);

or (OOP-style)

Digest::SHA->new(256)->add(1)->hexdigest()

相关问答

更多
  • 是的,他们是完全相同的。 都从表中删除所有现有的键和值,并将散列设置为空列表。 请参阅perldoc -f undef : undef EXPR undef取消定义EXPR的值,该值必须是左值。 仅使用标量值,数组(使用“@”),散列(使用“%”),子例程(使用“&”)或类型球(使用“*”)... 例子: undef $foo; undef $bar{'blurfl'}; # Compare to: delete $bar{'blur ...
  • 不同之处在于您如何表达哈希的内容。 例如,下面的数组符号; 你这样做: my %hash = ( 'key 1' => 'value 1', 'key 2' => 'value 2'); %{}是一个强制转换运算符。 通常在您引用显然不是哈希的内容时使用它。 通常,对a的引用具有: 例: my $hashref; $hashref->{'key 1'}='value 1'; $hashref->{'key 2'}='value 2'; my %hash = %{$hashref}; The diffe ...
  • %items是哈希引用的哈希(概念上是散列哈希)。 $set是%items的关键字,然后你得到另一个散列,它被添加到键'a-logdate'和'a-dataset' 。 (根据评论更正) %items is a hash of hash references (conceptually, a hash of hashes). $set is the key into %items and then you get back another hash, which is being added to with ...
  • 内置函数哈希值将返回所有哈希值的列表。 您可以使用它来获取或设置带有别名列表结构的任何值,例如foreach , map和grep : for my $value (values %hash) { say $value; # prints the value $value++; # adds one to the value } 或者您可以将值存储在数组中: my @vals = values %hash; 返回值的顺序实际上是随机的,但它将与相应的keys功能的顺序相同。 散列 ...
  • 哈希查找速度与哈希中的项目数无关,因此只执行一次哈希查找的版本将比执行三次哈希查找的版本更快地执行操作的哈希查找部分。 但另一方面,单一查找版本必须将三个密钥连接成单个字符串,然后才能将其用作组合密钥; 如果这个字符串是匿名的(例如, $hash{"$a,$b,$c"} ),那么这可能会涉及一些有趣的东西,比如内存分配。 总体而言,我希望连接速度足够快,以至于在大多数情况下,单向查找版本比三向查找版本快,但要知道在您的情况下哪个版本更快,唯一的方法是编写相同的代码风格和基准的差异。 然而,就像其他人已经说过 ...
  • 向后工作,它将$z的值赋给哈希引用的键y ,其中该引用被分配给名为%w的哈希的键$x 。 perl -wMstrict -MData::Dumper -E 'my %h; my $x=1; $h{$x}->{y}=3; print Dumper \%h;' $VAR1 = { '1' => { 'y' => 3 } }; 在Perl中,列表类型数据结构的值只能是标量项(单个实体),因此散列的第 ...
  • for my $family ( keys %HoH ) { if ($HoH{$family}->{checked}) { # Do what you want... } } for my $family ( keys %HoH ) { if ($HoH{$family}->{checked}) { # Do what you want... } }
  • 使用条件表达式: my $foo = { a => 1, b => ($flag == 1) ? 2 : 3 } 请注意,首次定义$foo时会评估条件。 如果随后更改$flag的值, $foo->{b}将不会更改。 Use the conditional expression: my $foo = { a => 1, b => ($flag == 1) ? 2 : 3 } Note that the conditional is evaluated when you first defi ...
  • 你不能使用Digest::SHA->sha256_hex(1)因为它实际上是Digest::SHA::sha256_hex("Digest::SHA", 1) 。 使用 Digest::SHA::sha256_hex(1) 要么 use Digest::SHA qw(sha256_hex); sha256_hex(1); 或(OOP式) Digest::SHA->new(256)->add(1)->hexdigest() You can't use Digest::SHA->sha256_hex ...
  • 假设你的数组看起来像这样: my @keys = qw/a b c a a/; my @values = qw/1 2 3 4 1/; 它就像一个简单的for循环一样简单: for ($i = 0; $i < scalar @keys; $i++) { $hash{$keys[$i]}{$values[$i]} += 1; } 然后,您可以使用嵌套循环迭代内部值(计数): foreach my $key (keys %hash) { while (my ($value, $count ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)