| | |
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 ajaxhelp animate array automatically beta box bug calendar cart checkbox child class codes column cookies createrange() css cursor decimal design disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox focus form forms frameworks google gwt html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp jump listbox masterpage math menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent php player post problem progressbar prototype redirect regex runtime scale scroll search select session shopping size sql text textarea toggle validation w3c web website window windowofwords windowsxp wysiwyg \n





