| | |
When website will open, popup has to come
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
Insert this in the header section of your (x)HTML document(s).
javascript Syntax (Toggle Plain Text)
<script type="text/javascript"> <!-- window.onload = function() { try { window.open('yourdesiredpage.html','popup!'); } catch(e) { alert('Unable to open another window!'); } } //--> </script>
dont use a popup
popups are routinely blocked for security
every day a larger proportion of browsers have popup blockers enabled.
because popups are annoying
sites that use popups get worse results than those that do not
use a layer and show/hide it as necessary
popups are routinely blocked for security
every day a larger proportion of browsers have popup blockers enabled.
because popups are annoying
sites that use popups get worse results than those that do not
use a layer and show/hide it as necessary
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
The code below is a popup layer, for mozilla/firefox dom and IE dom, so you will see each action declared twice for the different DOM.
Its a script included in the pages for certain properties, I manage apartments and houses, creates a button that shows or hides a layer containing text onclick.
the layer/window remains in position on screen untill the viewer actually clicks 'close'.
class='top/bottom' in the script are just the color schemes of the layer, different to the site scheme so that it looks like a different window, described in the external css file, they werent necessary to put in for function
The actual php include is much smaller, headers et al are declared in the outer file.
Not blocked/blockable, totally configurable in css for position appearance.
Its a script included in the pages for certain properties, I manage apartments and houses, creates a button that shows or hides a layer containing text onclick.
the layer/window remains in position on screen untill the viewer actually clicks 'close'.
class='top/bottom' in the script are just the color schemes of the layer, different to the site scheme so that it looks like a different window, described in the external css file, they werent necessary to put in for function
html Syntax (Toggle Plain Text)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr"> <head> <script language="javascript" type="text/javascript"> <!-- (document.getElementById) ? dom = true : dom = false; function hideIt() { if (dom) {document.getElementById("layer1").style.visibility='hidden';} if (document.layers) {document.layers["layer1"].visibility='hide';} } function showIt() { if (dom) {document.getElementById("layer1").style.visibility='visible';} if (document.layers) {document.layers["layer1"].visibility='show';} } onResize="window.location.href = window.location.href" //--></script> </head> <body> <button align="center" onClick="showIt();">Important Information</button> <div id="layer1" style="position:fixed; left:20px; width:45%; top:20px; visibility:hidden;"><!--Had to include the style from the ext sheet, else it would not be recognisable that this div will remain in place over the other layers until closed--> <table border="0" cellspacing="0" cellpadding="3"> <tr> <td Align="right" onClick="hideIt()" class="top"> <font Color="#ffffff"><Strong>Close</strong></font> </td> </tr> <tr> <td class="bottom"> <center><font size="+1"><b>Single Dwellings</b>:</font></center> Tenants & Residents of Single homes have different responsibilities to Tenants & Residents of Multi Unit Residential Developments. <UL compact> <li>The tenant is required to have current adequate tenant insurance, determined by Dockrey Apartments, at all times.</li> <li>The tenant is responsible for snow removal of their own approaches</li> <li>The tenant is responsible for lawn and garden care of the property.</li> <li>The tenant is responsible for properly sorting garbage and recyclables and appropriately placing for collection</li> <li>The tenant is responsible for payment of Fuel and Electricity charges.</li> </ul> </td> </tr> <tr> <td Align="right" onClick="hideIt()" class="top"> <font Color="#ffffff"><Strong>Close</strong></font> </td> </tr> </table> </div> </body></html>
Not blocked/blockable, totally configurable in css for position appearance.
Last edited by almostbob; Mar 9th, 2009 at 1:51 pm.
Failure is not an option It's included free
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
If at first you dont succeed, join the club
Of course its always in the last place you look, you dont keep looking after you find it
Please mark solved problems, solved
•
•
Join Date: Nov 2007
Posts: 52
Reputation:
Solved Threads: 2
Thanks for all, who are involved in this.
Finally i got some code, its solving my problem. Below the code
Just add this code in u r page or u can make a supparate page and give include file which page u want.
<SCRIPT type=text/javascript>
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
var dragswitch=0
var nsx
var nsy
var nstemp
function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}
function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY
tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)
dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")
function hidebox(){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}
</SCRIPT>
</HEAD>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style><BODY>
<DIV id=showimage
style="WIDTH:; POSITION: absolute; left: 300px; top: 250px; width: 336px;">
<TABLE cellSpacing=0 cellPadding=0 width=359 bgColor=#000080 border=0>
<TR>
<TD width="355" bgcolor="#FFFFFF"><TABLE width="100%" height=83 border=1 cellPadding=2 cellSpacing=0 bordercolor="#000000">
<TR>
<TD width="95%" bgcolor="#FF0000" class="sitehdlink" id=dragbar
style="CURSOR: pointer" onmousedown=initializedrag(event)>FocusMT Announcement</TD>
<TD width="5%" bgcolor="#FF0000" style="CURSOR: hand"><A onClick="hidebox();return false"
href="#"><IMG src=images/anounceclose.gif height=14 width=16 border=0></A></TD>
</TR>
<TR valign="top">
<TD height="61" colSpan=2 bgColor=#ffffff style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#FFFFE8">
<td colspan="2" class="blkbold">New Policies Uploaded</td>
</tr>
<tr>
<td width="177" height="5" colspan="1"></td>
</tr>
<tr>
<td colspan="1"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="6%" class="maincont">1.</td>
<td width="94%"><a href="sitemap.aspx" class="bodylink">Policy One</a></td>
</tr>
<tr>
<td class="maincont">2. </td>
<td><a href="sitemap.aspx" class="bodylink">Policy Two</a></td>
</tr>
<tr>
<td class="maincont">3.</td>
<td><a href="sitemap.aspx" class="bodylink">Policy One</a></td>
</tr>
<tr>
<td class="maincont">4. </td>
<td><a href="sitemap.aspx" class="bodylink">Policy Two</a></td>
</tr>
<tr>
<td height="5"></td>
<td height="5"></td>
</tr>
</table></td>
</tr>
</table></TD>
</TR>
</TABLE>
Finally i got some code, its solving my problem. Below the code
Just add this code in u r page or u can make a supparate page and give include file which page u want.
<SCRIPT type=text/javascript>
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all
var dragswitch=0
var nsx
var nsy
var nstemp
function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}
function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}
function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}
function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}
function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}
if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY
tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)
dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")
function hidebox(){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}
</SCRIPT>
</HEAD>
<style type="text/css">
<!--
body,td,th {
font-size: 12px;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
a:link {
text-decoration: none;
}
a:visited {
text-decoration: none;
}
a:hover {
text-decoration: none;
}
a:active {
text-decoration: none;
}
-->
</style><BODY>
<DIV id=showimage
style="WIDTH:; POSITION: absolute; left: 300px; top: 250px; width: 336px;">
<TABLE cellSpacing=0 cellPadding=0 width=359 bgColor=#000080 border=0>
<TR>
<TD width="355" bgcolor="#FFFFFF"><TABLE width="100%" height=83 border=1 cellPadding=2 cellSpacing=0 bordercolor="#000000">
<TR>
<TD width="95%" bgcolor="#FF0000" class="sitehdlink" id=dragbar
style="CURSOR: pointer" onmousedown=initializedrag(event)>FocusMT Announcement</TD>
<TD width="5%" bgcolor="#FF0000" style="CURSOR: hand"><A onClick="hidebox();return false"
href="#"><IMG src=images/anounceclose.gif height=14 width=16 border=0></A></TD>
</TR>
<TR valign="top">
<TD height="61" colSpan=2 bgColor=#ffffff style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"><table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr bgcolor="#FFFFE8">
<td colspan="2" class="blkbold">New Policies Uploaded</td>
</tr>
<tr>
<td width="177" height="5" colspan="1"></td>
</tr>
<tr>
<td colspan="1"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="6%" class="maincont">1.</td>
<td width="94%"><a href="sitemap.aspx" class="bodylink">Policy One</a></td>
</tr>
<tr>
<td class="maincont">2. </td>
<td><a href="sitemap.aspx" class="bodylink">Policy Two</a></td>
</tr>
<tr>
<td class="maincont">3.</td>
<td><a href="sitemap.aspx" class="bodylink">Policy One</a></td>
</tr>
<tr>
<td class="maincont">4. </td>
<td><a href="sitemap.aspx" class="bodylink">Policy Two</a></td>
</tr>
<tr>
<td height="5"></td>
<td height="5"></td>
</tr>
</table></td>
</tr>
</table></TD>
</TR>
</TABLE>
![]() |
Similar Threads
- popup script (JavaScript / DHTML / AJAX)
- How to open a popup page automatically? (HTML and CSS)
- newbie... Java load large picture :) Lit'l help plez (Java)
- On execution of perl script, popup asks if i want to save or run this file (Linux Servers and Apache)
- new popup window, chromeless / no scrolls? (JavaScript / DHTML / AJAX)
- Java Pop Up Window Disappears when launched from Website... (Web Browsers)
- Can't open anything in new window (Viruses, Spyware and other Nasties)
- Popups even with popup blocker and site redirection (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Google maps help
- Next Thread: Ajax Tooltip problem
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxjspservlets array browser bug captchaformproblem cart checkbox child class close codes cookies createrange() css cursor date debugger decimal dependent design disablefirebug dom dropdown editor element embed engine enter events explorer ext file firefox focus form forms frameworks getselection google gxt hiddenvalue highlightedword hint html ie7 ie8 iframe images index internet java javascript javascripthelp2020 jquery jsf jsfile jsp jump libcurl listbox maps masterpage math media menu mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent paypal pdf php position post programming progressbar prototype redirect runtime safari scale scriptlets scroll search security session shopping size software toggle unicode variables web wysiwyg \n






