javascript object declaration no working as i want it to
i am creating a (lame) game, in which i declare the object player like so:
var player = {
"id": "player",
"displayText" : "<img src =
'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg-eG_HT8y1uyGyfEnAOTV1PZmAyA2hCR3et4-UeSilkBw23CZaKHqQsIeOt1Odcxmzle5mqaiOSVqOTdTJ5157ryIqnytK6BGvQj8tipG9TYuXNeS64mLlu259ZNw6lrN7R0xq5Zs_s8I/s1600/smileys_001_01.png'"
+
"class='onTop' id='" + this.id + "' alt='you' border='0' />" +
"<div id = '" + this.id + "health' class = 'healthLost hide'></div>",
};
however this.id is returning undefined, why and what can i do to fix this?
No comments:
Post a Comment