0

我是 Web 开发和 Phonegap/Cordova 的新手。在下面的代码中,我预计该表将与版本、uuid 等一起归档,但我得到一个空列。

<!DOCTYPE HTML>
<html>
<head>
<title> Phone Gap </title>
<script type="text/javascript" src="cordova-1.9.0.js"></script>
<script type="text/javascript">

function onDeviceReady() {
    document.getElementById("deviceName").innerHtml=device.name;
    document.getElementById("version").innerHtml=device.cordova;
    document.getElementById("uuid").innerHtml=device.uuid;
}

function init() {
    document.addEventListener("deviceready", onDeviceReady, false);
}
</script>
</head>
<body onLoad="init()">
    <h1>Device Info </h1>
    <table border="1">
        <tr>
            <td>Device Name</td>
            <td id="deviceName"></td>
        </tr>
        <tr>
            <td>Version</td>
            <td id="version"></td>
        </tr>
        <tr>
            <td>UUID</td>
            <td id="uuid"></td>
        </tr>
    </table>
</body>
</html>
4

1 回答 1

1

它是innerHTML 不是innerHtml。

function onDeviceReady() {
    document.getElementById("deviceName").innerHTML=device.name;
    document.getElementById("version").innerHTML=device.cordova;
    document.getElementById("uuid").innerHTML=device.uuid;
}
于 2012-07-05T13:03:12.270 回答