小编kos*_*bou的帖子

jquery如何清空输入字段

我在移动应用程序中,我使用输入字段,以便用户提交一个号码.

当我返回并返回到输入字段的页面时,显示输入字段中显示的最新数字输入.

有没有办法在每次页面加载时清除该字段?

$('#shares').keyup(function(){
    payment = 0;
    calcTotal();
    gtotal = ($('#shares').val() * 1) + payment;
    gtotal = gtotal.toFixed(2);
    $("p.total").html("Total Payment: <strong>" + gtotal + "</strong>");
});
Run Code Online (Sandbox Code Playgroud)

jquery numbers field input

182
推荐指数
6
解决办法
32万
查看次数

jquery如何在另一个结束后使用多个ajax调用

我在移动应用程序中,我使用多个Ajax调用从Web服务器接收数据,如下所示

function get_json() {
    $(document).ready(function() {
        $.ajax({
            url: 'http://www.xxxxxxxxxxxxx',
            data: {
                name: 'xxxxxx'
            },
            dataType: 'jsonp',
            //jsonp: 'callback',
            //jsonpCallback: 'jsonpCallback',
            success: function(data) {
                $.each(data.posts, function(i, post) {
                    $.mobile.notesdb.transaction(function(t) {
                        t.executeSql('INSERT into bill (barcode, buildingcode, buildingaddress, flatname, flatdescription, entryseason, period, amount, pastpayments, todaypayments, paydate, receiptno) VALUES (?,?,?,?,?,?,?,?,?,?,?,?);', [post.Id, post.Code, post.Address, post.Name, post.Description, post.EntrySeason, post.Period, post.Revenue, post.PastPayments, post.todaypayments, post.paydate, post.receiptno],
                        //$.mobile.changePage('#page3', 'slide', false, true),  
                        null);
                    });
                    $('#mycontent').append(post.Name);
                });
            }
        });

        $.ajax({
            xxxx
        });

        $.ajax({
            xxxx
        });
    });
}
Run Code Online (Sandbox Code Playgroud)

如何强制第二次ajax呼叫在第一次结束后开始...第二次结束后第三次继续?

jquery jsonp get function

43
推荐指数
5
解决办法
10万
查看次数

如何在adb shell中使用find命令

我想检查我的android设备中的目录中是否有某个文件.

我在windows批处理中使用以下行

adb shell find /mnt/sdcard/koinoxrista -name Bill.txt
Run Code Online (Sandbox Code Playgroud)

如果文件存在,我想做一些事情,如果文件不存在,我想做其他事情.

我怎样才能做到这一点?

android batch-file adb toybox

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

如何使用opencv for java中的轮廓裁剪垫子

我正在使用以下代码来查找图像的垫轮廓.我发现轮廓正确.但是当我尝试在轮廓处裁剪图像时,应用程序崩溃了.我哪里错了?

        List<MatOfPoint> contours = new ArrayList<MatOfPoint>();    

        Imgproc.findContours(imageA, contours, new Mat(), Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE);
        for(int i=0; i< contours.size();i++){
            if (Imgproc.contourArea(contours.get(i)) > 50 ){
                Rect rect = Imgproc.boundingRect(contours.get(i));
                if (rect.height > 28){
                    Core.rectangle(image, new Point(rect.x,rect.y), new Point(rect.x+rect.width,rect.y+rect.height),new Scalar(0,0,255));
                    Mat ROI = image.submat(rect.x, rect.x + rect.heigth, rect.x, rect.x + rect.width);

                    Highgui.imwrite("/mnt/sdcard/images/test4.png",ROI);

                }
            }
        }
Run Code Online (Sandbox Code Playgroud)

java android opencv

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

如何在批处理中更改循环内的变量值

我使用下面的代码,以便从收集器文本文件的前4个字符的值创建一个目录

@echo off & setlocal enabledelayedexpansion

:loop

set /P txt_file=<Collector.txt
Set collector_id=!txt_file:~0,4!

:: check for existence of [OutputFolder]
:: if [OutputFolder] doesn't exist, create it
if not exist %collector_id% (
  echo folder %collector_id% not found
  echo creating folder %collector_id%
  md %collector_id% 
  )

xcopy *.txt %collector_id% /v 
Del *.txt

goto loop
Run Code Online (Sandbox Code Playgroud)

我想连续执行上面的循环,以检查当前目录是否为空.如果不是我想制作一个目录,如果不存在,名称为collector.txt的前4个字符.

如果目录不为空,一切正常.当上面循环并且我将collector.txt添加到当前目录时,collector_id不会改变.

我哪里错了?

有没有其他方式,期望无限循环来做到这一点?

variables loops batch-file

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

为什么我不能解析这个JSON?

我有以下JSON字符串:

var billjson = "({'posts' : [{'Id' :'      7553','Code' :'1186 ','Address' :' GGGG 39?                    ','Name' : ' GGGG NAME 3                               ','Description' : ' G 3    ','EntrySeason' : ' GGGGG 08-09      ','Period' : ' 10/2009   ','Revenue' : '      4.10'},{'Id' :'      7553','Code' :'1186 ','Address' :' GGGG 39?                    ','Name' : ' FFFF NAME 3                               ','Description' : ' F 3    ','EntrySeason' : ' FFFF 08-09      ','Period' : ' 10/2009   ','Revenue' : '      4.10'}]})"
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用代码创建一个JSON对象:

var mybilljson = jQuery.parseJSON( billjson );
Run Code Online (Sandbox Code Playgroud)

但控制台的结果是:

未捕获的无效JSON:

为什么?

javascript jquery json

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

标签 统计

jquery ×3

android ×2

batch-file ×2

adb ×1

field ×1

function ×1

get ×1

input ×1

java ×1

javascript ×1

json ×1

jsonp ×1

loops ×1

numbers ×1

opencv ×1

toybox ×1

variables ×1