问题列表 - 第23040页

jQuery - 在空格键的链接上触发点击事件?

看起来在大多数浏览器中,<input type="submit">将[空格键]和[输入]视为单击,但<a>链接仅将[输入]视为单击.

我的应用程序使用了许多格式化模拟按钮的链接,因此习惯于按Tab键切换按钮并按[空格键]的用户将感到沮丧.

这一点jQuery解决了这个问题:

$("a.Button").die("keypress").live("keypress", function(e) {
    if (e.which == 32) {
        $(this).trigger("click");
        e.preventDefault();
    }
});
Run Code Online (Sandbox Code Playgroud)

我的问题:有没有理由不这样做?我有点不愿意在基本的东西上覆盖浏览器的默认行为,但由于我已经滥用链接标签使其看起来像一个按钮,至少这样我不会违反用户的期望任何进一步.

jquery user-interface user-experience

9
推荐指数
1
解决办法
6556
查看次数

有没有办法使用ant有条件地复制文件?

我有以下目标:

<target name="promptforchoice">

  <input addproperty="choice">
     Copy the file?.  [Y, n]
  </input>

    <condition property="copy.file">
        <or>
            <equals arg1="Y" arg2="${choice}"/>
            <equals arg1="y" arg2="${choice}"/>
        </or>
    </condition>

</target>
Run Code Online (Sandbox Code Playgroud)

在另一个目标中,我想根据是否设置copy.file属性有条件地复制文件.这可能吗?还有其他方法可以实现吗?


我的解决方案

以下是我根据ChrisH的反应提出的建议.

<target name="promptforchoice">

  <input addproperty="choice">
     Copy the file?.  [Y, n]
  </input>

    <condition property="copy.file">
        <or>
            <equals arg1="Y" arg2="${choice}"/>
            <equals arg1="y" arg2="${choice}"/>
        </or>
    </condition>

</target>

<target name="copyfile" if="copy.file">
    <copy file="file1.cfg" tofile="file2.cfg"/>
</target>

<target name="build" depends="promptforchoice">
    <antcall target="copyfile"/>

    <!--  Other stuff goes here -->

</target>
Run Code Online (Sandbox Code Playgroud)

谢谢!

java ant

8
推荐指数
1
解决办法
3049
查看次数

绘制点而不是线?JFreeChart PolarChart

目前,PolarChart将所有坐标与创建多边形的线连接起来.我只是想用点来绘制每个点,而不是将它们连接在一起.这可能吗?

我曾尝试使用translateValueThetaRadiusToJava2D()和Graphics2D绘制圆圈,但它非常笨重和做作.

欢迎任何建议!

plot jfreechart

6
推荐指数
1
解决办法
4519
查看次数

Vim - ex模式命令 - 有没有办法移动光标位置?

在一行Vim ex命令中:

我正在尝试执行命令,然后移动到另一个位置并执行相同的命令.

有没有办法移动光标位置(需要左/右和上/下)?

vim scripting ex-mode

7
推荐指数
1
解决办法
3307
查看次数

操纵实体的类的名称

我有一个关于命名约定的一般问题.

如果我将数据和操作分成两个单独的类.一个具有数据元素(实体),另一个类操纵实体类.我们通常称那个操纵实体类的类是什么?

(我指的实体与任何类型的实体框架无关)

经理?控制器?运营商?机械手?

提前致谢

c# java language-agnostic naming-conventions

4
推荐指数
1
解决办法
2030
查看次数

支持通配符的System.StringComparer(*)

我正在寻找一个快速的.NET类/库,它具有支持通配符(*)AND incase-sensitivity的StringComparer.有任何想法吗?

.net c# stringcomparer

3
推荐指数
1
解决办法
1827
查看次数

如何查找groovy args是否包含特定字符串

println args

println args.size()

println args.each{arg-> println arg}

println args.class

if (args.contains("Hello"))
    println "Found Hello"
Run Code Online (Sandbox Code Playgroud)

当运行时给出以下错误:

[hello, somethingelse]
2
hello
somethingelse
[hello, somethingelse]
class [Ljava.lang.String;
Caught: groovy.lang.MissingMethodException: No signature of method: [Ljava.lang.
String;.contains() is applicable for argument types: (java.lang.String) values:
[Hello]
Run Code Online (Sandbox Code Playgroud)

为什么我不能这样做contains

groovy

7
推荐指数
1
解决办法
3万
查看次数

使用汇编程序x86写入.net

在计算机语言方面,我是一个初学者,并且被要求使用汇编程序x86编写.NET代码,此刻我就被困在这里.任何基本代码行都可以使用,但仍无法在网上找到任何代码行.

.net x86 assembly

0
推荐指数
2
解决办法
248
查看次数

在java中实例化泛型类型

重复:Java泛型为什么这不起作用

重复:在Java中实例化泛型类

我想在java中创建一个Generics Type对象.请建议我如何实现同样的目标.

注意:这似乎是一个微不足道的泛型问题.但我敢打赌......事实并非如此.:)

假设我有类声明:

public class Abc<T> {
    public T getInstanceOfT() {
       // I want to create an instance of T and return the same.
    }
}
Run Code Online (Sandbox Code Playgroud)

java generics

57
推荐指数
5
解决办法
7万
查看次数

如何在STAThread模式下运行单元测试?

我想测试一个使用剪贴板(WindowsForms)的应用程序,我也需要在单元测试中使用剪贴板.为了使用它,它应该在STA模式下运行,但由于NUnit TestFixture没有main方法,我不知道在哪里/如何注释它.

c# nunit sta

51
推荐指数
3
解决办法
2万
查看次数