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 // Constructor20 var dom = document.createElement('div');21 dom.style.position = 'fixed';22 dom.style.height = '100%';23 dom.style.width = '100%';24 dom.style.left = '0';25 dom.style.top = '0';26 dom.style.backgroundColor = 'rgba(255,255,255,0.8)';27 var dom_box = document.createElement('div');28 dom_box.style.border = 'solid black 1px';29 dom_box.style.minWidth = '300px';30 dom_box.style.position = 'absolute';31 dom_box.style.borderRadius = '8px';32 dom_box.style.backgroundColor = 'rgba(255,255,255,0.4)';33 dom_box.style.border = 'solid black 1px';34 dom_box.style.margin = '0 auto 0 auto';35 dom_box.style.overflow = 'auto';36 dom_box.style.boxShadow = '5px 5px 10px #000000';37 var dom_title = document.createElement('div');38 dom_title.innerHTML = 'Título';39 dom_title.style.fontSize = '12px';40 dom_title.style.backgroundColor = 'rgba(255,255,255,0.8)';41 dom_title.style.fontWeight = 'bold';42 dom_title.style.textAlign = 'center';43 dom_box.appendChild(dom_title);44 var dom_body = document.createElement('div');45 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><br><br>';46 dom_body.fontSize = '12px';47 dom_body.style.padding = '8px';48 dom_box.appendChild(dom_body);49 var dom_footer = document.createElement('div');50 dom_footer.innerHTML = 'Footer';51 dom_box.appendChild(dom_footer); 52 dom.appendChild(dom_box);53 54 document.body.appendChild(dom);55 56 this.center(); 57 }58 59 60 var midialog = new Dialog();61 62 63 64 65 </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: