小编Rya*_*ger的帖子

&符的事件键码?

我试图找到&符号和下划线的键码.我不应该允许我的用户允许输入&符号和下划线.我看了一个列表,它提到55作为7&ersand的键码,另一个列表说55是7的键码.所以如果我的用户点击键码55时返回false,我禁止用户使用7,这不是要求.如何找到&符号和下划线的密钥代码?

我只是尝试了55,但它只是给了我警报7而不是&符号!

function noenter(e)
{
    evt = e || window.event;
    var keyPressed = evt.which || evt.keyCode;

    if(keyPressed==13)
    {
        return false;
    }
    else if(evt.shiftKey && keyPressed===55)
//  else if(keyPressed==59 || keyPressed==38 || keyPressed==58 || keyPressed==95)
    {
        alert("no special characters");
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript key keycode

5
推荐指数
1
解决办法
6550
查看次数

JQuery验证在IE8中不起作用

我使用JQuery Validation脚本来验证HTML表单.这在Firefox中完美运行但在IE8中不起作用.我认为冒号(;)或分号(,)有问题...但我无法抓住它.

jQuery.validator.addMethod("selectNone", function (value, element) {
    if (element.value == "") {
        return false;
    } else return true;
}, "Please select an option.");

$(document).ready(function () {
    $("#formElem").validate({
        rules: {
            Category: { // "required",simple rule, converted to {required:true}
                selectNone: true
            },
            Repair_technician: { // "required",simple rule, converted to         {required:true}
                selectNone: true
            },
            Rework_technician: { // "required",simple rule, converted to     {required:true}
                selectNone: true
            },
            Approved_by: { // "required",simple rule, converted to {required:true}
                required: true,
            },
            Part_code: {
                required: true,
            },
            Part_value: { …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-validate internet-explorer-8

5
推荐指数
1
解决办法
6557
查看次数

如何在Rails上的Helper中编写JQuery

如何在Rails中的Helper函数中编写jQuery代码?

jquery ruby-on-rails helper

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

如何在java中减去或添加两个十六进制值

有没有办法计算两个十六进制值而不将其转换为int?例如:

String sHex = "f7c0";
String bHex = "040000000";
Run Code Online (Sandbox Code Playgroud)

java hex add subtraction

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

Android中的YouTube视频

我正在尝试在Android中加载YouTube视频.

我在xml中添加了一个WebView:

  <WebView android:id="@+id/VideoView"
           android:layout_height="fill_parent"
           android:layout_width="fill_parent" />
Run Code Online (Sandbox Code Playgroud)

然后我按如下方式加载它:

WebView webview = new WebView(this);
setContentView(R.layout.webview);

String htmlString = "<html> <body> <embed src=\"http://www.youtube.com/watch?v=XS998HaGk9M\"; type=application/x-shockwave-flash width="+640+" height="+385+"> </embed> </body> </html>";   
webview.loadData(htmlString, "text/html", "utf-8");
Run Code Online (Sandbox Code Playgroud)

我已经为清单添加了适当的权限.我收到的只是一个空白的白色屏幕,没有任何负载.

有人可以帮我这个吗?

youtube android

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

在Java中将八进制转换为十六进制的函数

有没有一个函数我可以用来在八进制中将八进制转换为十六进制?

java

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

每次打开我的应用程序时,如何使复选框保持相同状态?

我的活动上有一个复选框.我想知道每次打开我的应用程序时如何使其状态保持不变(选中/取消选中).

android

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