-1

我想使用 phonegap 开发一个 android 应用程序(聊天信使),谁能告诉我如何在 html 代码中使用 9-patch 图像以及我可以使用哪些 php 网络服务。

提前谢谢..:)

4

1 回答 1

0

功能getproducts(){

    var bookIdlist = window.localStorage.getItem("BoolId");
    function ajaxRequest() {

        var activexmodes = [ "Msxml2.XMLHTTP", "Microsoft.XMLHTTP" ] //activeX versions to check for in IE
        if (window.ActiveXObject) { //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
            for ( var i = 0; i < activexmodes.length; i++) {
                try {
                    return new ActiveXObject(activexmodes[i])
                } catch (e) {
                    //suppress error
                }
            }
        } else if (window.XMLHttpRequest) // if Mozilla, Safari etc
            return new XMLHttpRequest()
        else
            return false
    }

    var mypostrequest = new ajaxRequest();
    mypostrequest.onreadystatechange = function() {
        if (mypostrequest.readyState == 4) {
            if (mypostrequest.status == 200
                    || window.location.href.indexOf("http") == -1) {
                console.log("Responce::" + mypostrequest.responseText);
                var result = mypostrequest.responseText;
                var obj = $.parseJSON(result);
                document.getElementById("packlistdata").style.display = "block";
                var str = ""
                for (i = 0; i < obj.products.length; i++) {
                    str += "<div data-role='fieldcontain'></div><h3 style='color: #085bab'><span id='pack"+i+"'>"
                            + obj.products[i].name
                            + "</span> = <span id='costs"+i+"'>"
                            + obj.products[i].cost
                            + "</span></h3><h4  style='font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #535455; text-align: left; padding: 0'>"
                            + obj.products[i].description
                            + "</h4><h4 style='font-family: Arial, Helvetica, sans-serif; font-size: 13px; color: #535455; text-align: left; padding: 0'>"
                            + obj.products[i].ISBN
                            + "</h4><img style='width:55%;height:40%' src='"
                            + obj.products[i].image
                            + "' alt='image' /><div class='clear'></div><input id='"
                            + i
                            + "' onclick='sendId(this.id)' type='submit' data-inline='true' data-theme='b' data-icon='plus' data-iconpos='right' value='Add To Cart' /><br/><div style='margin:5%'><hr/></div>";

                }
                document.getElementById("packlistdata").innerHTML = str;
            } else {
                console.log("An error has occured making the request");
            }
        }
    }

    var parameters = "sub=showproducts&ptype=books" + "&pid=" + bookIdlist;
    mypostrequest
            .open(
                    "POST",
                    "http://,
                    false)

    mypostrequest.setRequestHeader("Content-type",
            "application/x-www-form-urlencoded")
    mypostrequest.send(parameters);

}
于 2013-01-24T12:21:46.453 回答