1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| function addWidget(title,posx,posy,w,h){
var ref=document.getElementById("content");
var wid='id'+counter; //unique ID
counter++;
var wstr="<div id='"+wid+"' class='widget' style='position: absolute; top: "+posy+"; left: "+posx+"; width: "+w+"px; height: "+h+"'>"+
"<div style='cursor: move; width: 100%; height: 16; "+
"background-color: #CCCCFF; border-bottom: 1px solid #CACACA; '>"+
"<table style='font-family: arial; font-size: 8pt;' width=100% cellpadding=0 cellspacing=0 border=0>"+
"<tr><td ALIGN=left span id='titlebar' style='padding-left: 5px;'>"+title+"</td>"+
"<td align=right style='padding-right: 5px;'>" +
"<a href=javascript:closeWidget('"+wid+"') style='text-decoration: none;'>"+
"<b>X</b></a></td></tr></table></div>"+
"<div id='"+title+"body' style='padding: 5px; font-family: arial; font-size: 8pt; width: 100%'>"+
"Widget Body </div></div>";
ref.innerHTML+=wstr; //place the widget on screen
WidgetArray.push(wid);
} |
Partager