科尔多瓦。如果单击当前对象,则无反应

时间:2018-09-14 08:53:38

标签: cordova events event-handling this

我想获取用户单击的对象并更改该对象的颜色。 但是什么也没发生,控制台没有错误。
HTML:

<body onload="onLoad()">

JS文件:

    function onLoad() {
        document.addEventListener("deviceready", onDeviceReady, false);
    }

    function onDeviceReady() {
    ...
//only this event doesn't work
        document.querySelector("body").addEventListener("rename", function(event) {
            rename(event, this);
        }, false);
    }

    function rename(event, currentObject) {
        currentObject.sytle.backgroundColor = "red";
    }

0 个答案:

没有答案