例如
<html>
<script>
function getCoords(e) {
document.getElementById("xCoord").innerHTML = e.clientX;
document.getElementById("yCoord").innerHTML = e.clientY;
}
</script>
<body onmousemove="getCoords(event)">
X:<span id="xCoord"></span> Y:<span id="yCoord"></span>
</body>
</html>
这会起作用吗?
Hello world
var todopopup = new TodoPopup(); todopopup.open();
答案 0 :(得分:2)
您必须像
那样创建一个新实例var todopupup = document.createElement('todo-popup');
另见https://www.polymer-project.org/1.0/docs/devguide/registering-elements
你可以把它贴在某处。
document.body.appendChild(todopupup);
todopopup.open();