如何测试文件是否是批处理脚本中的目录?(How to test if a file is a directory in a batch script?)
有没有办法找出文件是否是目录?
我有一个变量的文件名。 在Perl我可以这样做:
if(-d $var) { print "it's a directory\n" }
Is there any way to find out if a file is a directory?
I have the file name in a variable. In Perl I can do this:
if(-d $var) { print "it's a directory\n" }
原文:https://stackoverflow.com/questions/138981
更新时间:2023-07-21 19:07
最满意答案
因为
$(this)
引用了<li>
元素,并且使用$(this).index(this)
,所以实质上是询问当前元素的索引 - 显然是0。Because
$(this)
references to the<li>
element, and by using$(this).index(this)
, you are essentially asking the index of the current element inside itself - which obviously is 0.
相关问答
更多-
如何获取
- 元素的索引(How to get index of
- element)
[2021-02-14]因为$(this)引用了- 元素,并且使用$(this).index(this) ,所以实质上是询问当前元素的索引 - 显然是0。 Because $(this) references to the
- element, and by using $(this).index(this), you are essentially asking the index of the current element inside itself - which obviously is 0.
-
从字符串获取最后一个
- 元素(Get last
- element from a string)
[2023-05-07]HTML不规则,所以不能用正则表达式解析。 使用合适的HTML解析器 。 HTML is not regular, and so can't be parsed with a regular expression. Use a proper HTML parser. -
除了已应用的其他样式之外, li a以下代码添加到li a选择器。 li a {display:inline-block;} 检查更新的JSFIDDLE 重要的是,对于响应式网页,您也应该使用媒体查询。 Add the following code to the li a selector apart from other styles that you have applied. li a {display:inline-block;} Check the updated JSFIDDLE The i ...
-
你的destroy.js.erb模板没有得到用户变量,因为它是未定义的。 尝试: def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.js end end 和 $("li#<%= @user.id %>").remove(); 这是有效的原因是因为rails通过使用@前缀设置变量将数据从控制 ...
-
您需要在点击功能中使用this对象。 http://jsfiddle.net/kuJWc/ $("li").click(function(){ var str = $(this).index(); alert(str); }); 根据你的编辑: $("#amastorage ul").find('a').click(function () { var str = $(this).parents("li").index(); alert(str); }); ...
-
获取多个父母的li索引(Get index of li in multiple parents)[2022-11-20]
您可以使用: var index = $(li).closest('.group-fields').find('li').index( li ); 下面我只是将click事件用于演示目的: $('li').on('click', function() { //this is how to::: var index = $(this).closest('.group-fields').find('li').index( this ); console.log( 'You clicked l ... -
是否可以引用
- 索引?(Is it possible to refer to a
- index?)
[2023-07-24]HTML不提供这种机制。 您需要服务器端或客户端脚本来实现这一点。 您也可以尝试使用CSS counter属性: https : //developer.mozilla.org/en-US/docs/Web/Guide/CSS/Counters HTML doesn't provide such mechanism. You need server-side or client-side scripting to achieve this. You can also try using CSS counte ... -
您可以使用以下命令获取列表中的当前索引 $( this ).index(); You can use the following to get the current index in the list $( this ).index();
-
用按钮点击获取li的索引(Get index of li with button click)[2023-02-07]
尝试这个: $(document).ready(function(){ $(":button").click(function(e){ e.preventDefault(); var index = $(this).parent().index(); $('#mytabs li:eq(index) a').tab('show'); }); }); Try this: $(document).ready(function(){ $(": ... -
尝试使用.closest() $(".stepinstallment label").on("click", function() { console.log($(this).closest("li").index()) }); $('.stepinstallment label').on('click', function(){ console.log($(this).closest("li").index()) });