ID元素不显示

时间:2012-07-05 09:12:06

标签: android cordova

我是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>

1 个答案:

答案 0 :(得分:1)

这是innerHTML而不是innerHtml。

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