943,685 Members | Top Members by Rank

Ad:
Feb 26th, 2009
0

When website will open, popup has to come

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
kavithakesav is offline Offline
52 posts
since Nov 2007
Feb 27th, 2009
0

Re: When website will open, popup has to come

Insert this in the header section of your (x)HTML document(s).
javascript Syntax (Toggle Plain Text)
  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>
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Mar 2nd, 2009
0

Re: When website will open, popup has to come

its not working...
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
kavithakesav is offline Offline
52 posts
since Nov 2007
Mar 2nd, 2009
0

Re: When website will open, popup has to come

Then this is another crossbrowser issue. You will need to add an eventListener in your onload event to make this work.
Featured Poster
Reputation Points: 114
Solved Threads: 138
Posting Shark
essential is offline Offline
973 posts
since Aug 2008
Mar 2nd, 2009
0

Re: When website will open, popup has to come

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
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Mar 9th, 2009
0

Re: When website will open, popup has to come

Thanks for u r suggestion.

Can u tell me how to work on that.
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
kavithakesav is offline Offline
52 posts
since Nov 2007
Mar 9th, 2009
0

Re: When website will open, popup has to come

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
html Syntax (Toggle Plain Text)
  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.
Reputation Points: 562
Solved Threads: 368
Posting Maven
almostbob is offline Offline
2,970 posts
since Jan 2009
Mar 17th, 2009
0

Re: When website will open, popup has to come

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>
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
kavithakesav is offline Offline
52 posts
since Nov 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in JavaScript / DHTML / AJAX Forum Timeline: Google maps help
Next Thread in JavaScript / DHTML / AJAX Forum Timeline: Looking for Safari sniffer for flash





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC