小编Luc*_*eno的帖子

用dart隐藏和显示带有CSS的web元素?

我很想学习如何使用dart隐藏和显示html中的元素.我在考虑使用display:none; 在CSS中.但是,对于不同的HTML标记,我如何更改CSS值或在dart中编写CSS?

谢谢.

html css show hide dart

4
推荐指数
1
解决办法
1479
查看次数

我不知道为什么我得到一个"未定义不是函数"错误

所以我不知道为什么,在第35行,我得到这个错误,有人可以解释为什么这不起作用,因为我似乎无法弄清楚为什么?

这是其上传的网页的链接,您可以在控制台中看到错误消息,以及所有代码.http://matthew-hoyle.co.uk/files/beta/projects/platformer.php

window.onload = function() {
var canvas = document.getElementById("canvas");
var c = canvas.getContext("2d");

canvas.width  = 800;
canvas.height = 600;

function Player() {
    this.width = 20;
    this.height = 20;
    this.color = "red";
    this.posY = (canvas.height / 2) - (this.height / 2);
    this.posX = (canvas.width / 2) - (this.width / 2);
    this.volY = 0;
    this.volX = 0;
    this.gravity = 0.5;
    this.onGround = true;
    this.draw = function() {this.posY += this.volY;
        this.posX += this.volX;
        this.volY += this.gravity;

        c.fillStyle = this.color;
        c.fillRect(this.posX, this.posY, …
Run Code Online (Sandbox Code Playgroud)

javascript html5 canvas undefined

-2
推荐指数
1
解决办法
206
查看次数

标签 统计

canvas ×1

css ×1

dart ×1

hide ×1

html ×1

html5 ×1

javascript ×1

show ×1

undefined ×1