I have a predefined working website, that would be hard to redefine from top to bottom, but I am trying to implement some Test and Target using mboxes. On research I have found that the best place to implement mbox is using global mbox. As the structure needs to be setup on the go, i was planning to use some native javascript to add the globalmbox to the top of the page, like:
var mbox_html = document.createElement("div");
mbox_html.class="mboxGlobal";
//Script child to add to the top to create mbox
mbox_script = document.createElement("script");
mbox_script.type ="text/javascript";
mbox_script.textContent="mboxCreate('b_tntGlobal');";
document.body.insertBefore(mbox_script,document.body.firstChild);
document.body.insertBefore(mbox_html,document.body.firstChild);
Will this be effective implementation? Will mbox.js actually accept something like this, as I am adding this piece of code to the end of the page, and the DOM is already loaded before this is implemented