0

I have my canvas saved as an object but it won't let me add an eventListener because it creates this error:

Object #<Object> has no method 'addEventListener' 

This is how i create the canvas:

    var i = 1;
    document.getElementById("G").innerHTML += '<canvas id="layer'+i+'" class="c" style="z-index:'+i+';"></canvas>'; 
    temp = document.getElementById('layer'+i);
    objname = 'canvas'+i;
    canvas[objname] = new Object();
    canvas[objname].ctx =  temp.getContext("2d");   

Then i do:

canvas.canvas1.addEventListener("mousedown", fnc_test, false);

Any ideas why this is not allowed, or where I am going wrong??


In SQL, how to change the value in the table at the time of query

I have a table names TableA like

Id |Student | Subject | 
=======================
1  | XY     | M       |
2  | YZ     | Ph      |
3  | DD     | CH      |
4  | HH     |  M      |
=======================

At the time of query i want to show Math instead of M, Physics instead of Ph and so forth. I dont want to change in the table but in the query, is this possible in sql server.

4

1 に答える 1

1

私はあなたが意味したと思います

canvas[objname] = temp;
canvas[objname].ctx = temp.getContent("2d");

そこに理由はまったくありませんnew Object...

于 2012-12-06T06:00:04.263 に答える