From 21f0d3d3f6cb2de66fff3f26376c1df0e4958df3 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 2 Jun 2010 17:13:59 +0000 Subject: [PATCH] Start with ibox --- html/js/scripts.js | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/html/js/scripts.js b/html/js/scripts.js index 4c2f7271e..fbe50055f 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -372,4 +372,33 @@ function success_set_tva_label(req) { function set_wait(name) { var content=name+"_content"; $(content).innerHTML= 'Chargement...'; -} \ No newline at end of file +} +/** + *@brief add dynamically a object for AJAX + *@param obj. + * the attributes are + * - style to add style + * - id to add an id + * - class to add a class + */ +function add_div(obj) { + try { + var top=document; + var elt=top.createElement('div'); + if (obj.id ) { elt.setAttribute('id',obj.id);} + if (obj.style) { + if (elt.style.setAttribute) { /* IE7 bug */ + elt.style.setAttribute('cssText',obj.style); + } else { /* good Browser */ + elt.setAttribute('style',obj.style); + } + } + if (obj.cssclass ) { + elt.setAttribute('class',obj.cssclass);/* FF */ + elt.setAttribute('className',obj.cssclass); /* IE */ + } + if (obj.html) { elt.innerHTML=obj.html;} + var bottom_div=document.body; + bottom_div.appendChild(elt); + } catch (e) { alert(e.message);} +}