Add a div to the dom?

0 favourites
  • 2 posts
From the Asset Store
Add SubRip (SRT) subtitles to your videos in Construct 3
  • Please help,

    I've been trying to dynamically create a div to add to my program. What I have doesn't work. Could someone help me figure out what I'm doing wrong in my runtime. Here is the action:

    Acts.prototype.Like_Button = function (l_verb, l_color, l_under, l_layout,l_faces,l_url,l_code)

    {

    var div1 = document.createElement("div");

    div1.style.position="absolute";

    div1.style.left="100px";

    div1.style.top = "10px";

    //div1.style.color = "white";

    div1.innerHTML = '<div class="fb-like" data-href="http://lancelocke.yourhosting.com/fb/" data-layout="box_count" data-action="recommend" data-show-faces="true" data-share="true" data-ref="home_rec"></div>';

    document.body.appendChild (div1);

    };

    Any help would be greatly appreciated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That code looks like it ought to work, but that "fb-like" inner div looks like it will do nothing by itself unless you also include the script that makes it do something. TBH this isn't much specific to Construct 2, it's just ordinary JS code, so maybe you could ask somewhere like stackoverflow.com.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)