| | |
popup with background disabled
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Try this simple demo of a custom popup:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html id="html40L" lang="en"> <head> <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7"> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="Content-Style-Type" content="text/css"> <meta http-equiv="Content-Script-Type" content="text/javascript"> <meta http-equiv="Window-target" content="_top"> <title>Free Live Help!</title> <style type="text/css"> <!-- label + div { margin-bottom : 1em; font : 700 16pt "Trebuchet MS", "Bernard MT Condensed", Verdana, Arial, sans-serif; } --> </style> <script type="text/javascript"> <!-- var customPopup = function( w, h, elem ) { elem = (( document.getElementById ) ? document.getElementById( elem ) : document.all[ elem ] ); var checked = true; var posTop; var posLeft; try { if ( document.body.scrollWidth ) { posLeft = document.body.scrollWidth; posTop = (( window.screen.availHeight ) ? screen.availHeight : document.body.scrollHeight ); } } catch( error ) { if ( window.scrollMaxY ) { posLeft = window.scrollMaxX; posTop = window.scrollMaxY; } else { check = false; } } if ( checked ) { // You can implement more style rules from here. var divWidth = (( posLeft * w ) / 100 ); var divHeight = (( posTop * h ) / 100 ); elem.style.width = divWidth; elem.style.height = divHeight; elem.style.backgroundColor = "#eee"; elem.style.border = "2px solid #405060"; elem.style.position = "absolute"; elem.style.left = Math.ceil((( posLeft - divWidth ) / 2 )) + "px"; elem.style.top = Math.ceil((( posTop - divHeight ) / 2 )) + "px"; } }; window.onload = function() { customPopup( 40, 40, "main" ); } // --> </script> </head> <body> <div id="main"><div style="padding : 1em; color : #405060; text-align : center"><h1 style="margin : 0 auto; padding : 0;">Custom Popup</h1></div></div> </body> </html>
![]() |
Similar Threads
- Softwares worth downloading (Windows NT / 2000 / XP)
- button background colour on mouse enter event (VB.NET)
- Virus changed background and disabled the option to change background and screensaver (Viruses, Spyware and other Nasties)
- Virus changed background and disabled the option to change background and screensaver (Viruses, Spyware and other Nasties)
- Javascript Page Preloader- (JavaScript / DHTML / AJAX)
- I Need Help..... (Viruses, Spyware and other Nasties)
- Logitech Wingman force blue screens when plugged in (USB Devices and other Peripherals)
- Bogus "page cannot be displayed" error on URL http:/// (Viruses, Spyware and other Nasties)
- "The page cannot be displayed." (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Problem in tabbed pane working by java script
- Next Thread: javascript not interpreting php return variable
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor decimal dependent design disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms google gwt gxt hiddenvalue highlightedword html htmlform ie8 iframe images index internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl listbox math media microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php player post problem progressbar regex runtime scroll search security select shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





