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

Join Date: Nov 2007
Posts: 52
Reputation: kavithakesav is an unknown quantity at this point 
Solved Threads: 2
kavithakesav kavithakesav is offline Offline
Junior Poster in Training

When website will open, popup has to come

 
0
  #1
Feb 26th, 2009
Hi Everybody,

I need some hlep for my website. Whenever i will open my website one pop is required.

Can anyone tell me how to do.... please.

Thanks in Advance.
KavithaKesav
Last edited by kavithakesav; Feb 26th, 2009 at 3:38 am.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: When website will open, popup has to come

 
0
  #2
Feb 27th, 2009
Insert this in the header section of your (x)HTML document(s).
  1. <script type="text/javascript">
  2. <!--
  3. window.onload = function() { try {
  4. window.open('yourdesiredpage.html','popup!'); } catch(e) { alert('Unable to open another window!'); } }
  5. //-->
  6. </script>
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 52
Reputation: kavithakesav is an unknown quantity at this point 
Solved Threads: 2
kavithakesav kavithakesav is offline Offline
Junior Poster in Training

Re: When website will open, popup has to come

 
0
  #3
Mar 2nd, 2009
its not working...
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 954
Reputation: essential will become famous soon enough essential will become famous soon enough 
Solved Threads: 131
Featured Poster
essential's Avatar
essential essential is offline Offline
Posting Shark

Re: When website will open, popup has to come

 
0
  #4
Mar 2nd, 2009
Then this is another crossbrowser issue. You will need to add an eventListener in your onload event to make this work.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,335
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is online now Online
Nearly a Posting Virtuoso

Re: When website will open, popup has to come

 
0
  #5
Mar 2nd, 2009
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
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 52
Reputation: kavithakesav is an unknown quantity at this point 
Solved Threads: 2
kavithakesav kavithakesav is offline Offline
Junior Poster in Training

Re: When website will open, popup has to come

 
0
  #6
Mar 9th, 2009
Thanks for u r suggestion.

Can u tell me how to work on that.
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 1,335
Reputation: almostbob has a spectacular aura about almostbob has a spectacular aura about 
Solved Threads: 163
almostbob's Avatar
almostbob almostbob is online now Online
Nearly a Posting Virtuoso

Re: When website will open, popup has to come

 
0
  #7
Mar 9th, 2009
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
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
  3. <head>
  4. <script language="javascript" type="text/javascript">
  5. <!--
  6. (document.getElementById) ? dom = true : dom = false;
  7. function hideIt() {
  8.  if (dom) {document.getElementById("layer1").style.visibility='hidden';}
  9.  if (document.layers) {document.layers["layer1"].visibility='hide';} }
  10. function showIt() {
  11.  if (dom) {document.getElementById("layer1").style.visibility='visible';}
  12.  if (document.layers) {document.layers["layer1"].visibility='show';} }
  13. onResize="window.location.href = window.location.href"
  14. //--></script>
  15. </head>
  16. <body>
  17. <button align="center" onClick="showIt();">Important Information</button>
  18. <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-->
  19. <table border="0" cellspacing="0" cellpadding="3">
  20. <tr>
  21. <td Align="right" onClick="hideIt()" class="top">
  22. <font Color="#ffffff"><Strong>Close</strong></font>
  23. </td>
  24. </tr>
  25. <tr>
  26. <td class="bottom">
  27. <center><font size="+1"><b>Single Dwellings</b>:</font></center>
  28. Tenants &amp; Residents of Single homes have different responsibilities to Tenants &amp; Residents of Multi Unit Residential Developments.
  29. <UL compact>
  30. <li>The tenant is required to have current adequate tenant insurance, determined by Dockrey&nbsp;Apartments, at all times.</li>
  31. <li>The tenant is responsible for snow removal of their own approaches</li>
  32. <li>The tenant is responsible for lawn and garden care of the property.</li>
  33. <li>The tenant is responsible for properly sorting garbage and recyclables and appropriately placing for collection</li>
  34. <li>The tenant is responsible for payment of Fuel and Electricity charges.</li>
  35. </ul>
  36. </td>
  37. </tr>
  38. <tr>
  39. <td Align="right" onClick="hideIt()" class="top">
  40. <font Color="#ffffff"><Strong>Close</strong></font>
  41. </td>
  42. </tr>
  43. </table>
  44. </div>
  45. </body></html>
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.
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 52
Reputation: kavithakesav is an unknown quantity at this point 
Solved Threads: 2
kavithakesav kavithakesav is offline Offline
Junior Poster in Training

Re: When website will open, popup has to come

 
0
  #8
Mar 17th, 2009
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>
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC