1 <div id="resultado">2 </div>3 4 5 <script type="text/javascript">6 var res = document.getElementById('resultado');7 8 9 var Dialog = function() {10 this.show = function() {11 12 }13 14 this.center = function() {15 dom_box.style.left = (dom.clientWidth/2 - dom_box.clientWidth/2)+'px';16 dom_box.style.top = (dom.clientHeight/3 - dom_box.clientHeight/3)+'px';17 }18 19 this.setTitle = function(title) {20 dom_title.innerHTML = title;21 }22 23 // Constructor24 var dom = document.createElement('div');25 dom.style.position = 'fixed';26 dom.style.height = '100%';27 dom.style.width = '100%';28 dom.style.left = '0';29 dom.style.top = '0';30 dom.style.backgroundColor = 'rgba(255,255,255,0.8)';31 var dom_box = document.createElement('div');32 dom_box.style.border = 'solid black 1px';33 dom_box.style.minWidth = '300px';34 dom_box.style.position = 'absolute';35 dom_box.style.borderRadius = '8px';36 dom_box.style.backgroundColor = 'rgba(255,255,255,0.4)';37 dom_box.style.border = 'solid black 1px';38 dom_box.style.margin = '0 auto 0 auto';39 dom_box.style.overflow = 'auto';40 dom_box.style.boxShadow = '5px 5px 10px #000000';41 var dom_title = document.createElement('div');42 dom_title.innerHTML = 'Título';43 dom_title.style.fontSize = '14px';44 dom_title.style.backgroundColor = 'rgba(255,255,255,0.8)';45 dom_title.style.fontWeight = 'bold';46 dom_title.style.padding = '4px';47 dom_title.style.textAlign = 'center';48 dom_box.appendChild(dom_title);49 var dom_body = document.createElement('div');50 dom_body.innerHTML = 'Body<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>';51 dom_body.style.fontSize = '12px';52 dom_body.style.padding = '8px';53 dom_box.appendChild(dom_body);54 var dom_footer = document.createElement('div');55 dom_footer.innerHTML = 'Footer';56 dom_footer.style.padding = '0 0 8px 0';57 dom_footer.style.fontSize = '12px';58 dom_box.appendChild(dom_footer); 59 dom.appendChild(dom_box);60 61 document.body.appendChild(dom);62 63 this.center(); 64 }65 66 67 var midialog = new Dialog();68 69 midialog.setTitle('Mi Título');70 71 72 </script>
Este ShareCode tiene versiones:
- var res = document.getElementById('... (19/04/2011)
- var res = document.getElementById('... (24/04/2013)
- var res = document.getElementById('... (24/04/2013)
- var res = document.getElementById('... (24/04/2013)
- var res = document.getElementById('... (24/04/2013)
- var res = document.getElementById('... (24/04/2013)
Enlace
El enlace para compartir es: