...

View Full Version : Pop up once not working for IE?



mcbc
07-17-2008, 02:06 PM
The onlypop up once is not working for IE.

Code:
// JavaScript Document
var expDays = 1; // number of days the cookie should last

var page = "GradCertificates.html";
var windowprops = "width=300,height=200,location=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes";

function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
var exp = new Date();
exp.setTime (exp.getTime() - 1);
var cval = GetCookie (name);
document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

var exp = new Date();
exp.setTime(exp.getTime() + (expDays*24*60*60*1000));

function amt(){
var count = GetCookie('count')
if(count == null) {
SetCookie('count','1')
return 1
} else {
var newcount = parseInt(count) + 1;
DeleteCookie('count')
SetCookie('count',newcount,exp)
return count
}
}

function getCookieVal(offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}

function checkCount() {
var count = GetCookie('count');
if (count == null) {
count=1;
SetCookie('count', count, exp);
window.open(page, "", windowprops);
} else {
count++;
SetCookie('count', count, exp);
}
}

window.onload=checkCount;


here is the .html file

Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<SCRIPT LANGUAGE="javascript" type="text/javascript" src="KMJS.js"></SCRIPT>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Certificates</title>
<script type="text/javascript" src="onlyPopupOnce.js"></script>
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #99FF33;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
padding: 0;
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.oneColFixCtrHdr #container {
width: 780px; /* using 20px less than a full 800px width allows for browser chrome and avoids a horizontal scroll bar */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.oneColFixCtrHdr #header {
background: #669966;
padding: 0 10px 0 20px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
}
.oneColFixCtrHdr #header h1 {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
}
.oneColFixCtrHdr #mainContent {
padding: 0 20px; /* remember that padding is the space inside the div box and margin is the space outside the div box */
background: #FFFFFF;
}
.oneColFixCtrHdr #footer {
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#669966;
}
.oneColFixCtrHdr #footer p {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
}
.style4 {font-size: 12px}
.style6 {font-size: 12px; font-weight: bold; }
.style7 {
font-weight: bold;
font-size: 10px;
}
.style8 {color: #FFFFFF}
.style10 {font-size: 9px}
.style13 {
font-size: 28px;
font-weight: bold;
}
-->
</style></head>

<body class="oneColFixCtrHdr">

<div id="container">
<div id="header">
<h1 class="style8"><img src="images/headerslice.jpg" alt="Green Real Estate Education" width="750" height="161" border="0" usemap="#Map" /></br><span class="style13">Green Real Estate Education Downloads</span></h1>
<!-- end #header --></div>
<div id="mainContent">
<h1><img align="middle" src="Certificates/CertLow.JPG" width="400" height="250" border="1" /></br>
</h1>
<h1><span class="style4"><a href="http://www.greenrealestateeducation.com/Certificates/Cert.JPG">Certificate</a>
<span class="style10">(Either right click on object and save as, or click here and save as.)</span></span>
<!-- end #mainContent -->
</h1>
<p class="style6"><a href="http://www.greenrealestateeducation.com/Certificates/PWPRealtorSeries.ppt">Power Point</a></p>
<p class="style6"><a href="http://www.greenrealestateeducation.com/Certificates/IamGLCertified.JPG"> I Am GL Certified Green Logo</a></p>
<p class="style6"><a href="http://www.greenrealestateeducation.com/Certificates/SeanCertification.JPG">Sean's July 17th class</a></p>
</div>
<div id="footer">
<p align="center" class="style4"><span class="style7"><a href="http://www.greenrealestateeducation.com/index.html">Home </a>|<a href="http://www.greenrealestateeducation.com/aboutus.html">About Us</a>| <a href="http://www.greenrealestateeducation.com/contactus.html">Contact Us</a> |<a href="http://www.greenrealestateeducation.com/sitemap.html">Site Map</a>| <a href="http://www.greenrealestateeducation.com/realtor.html">Realtors</a> |<a href="http://www.greenrealestateeducation.com/mortgage.html">Mortgage Pros</a> |<a href="http://www.greenrealestateeducation.com/appraiser.html">Appraisers</a>| <a href="http://www.greenrealestateeducation.com/inspector.html">Home Inspectors</a>| <a href="http://www.greenrealestateeducation.com/certifications.html">Certifications</a> |<a href="http://www.greenrealestateeducation.com/coursedates.html">Course Dates</a>| <a href="http://www.greenrealestateeducation.com/instructors.html">Instructors</a> |<a href="http://www.greenrealestateeducation.com/greenresources.html">Resources</a>| <a href="http://www.greenrealestateeducation.com/greennews.html">Green News</a></span></p>
<!-- end #footer --></div>
<!-- end #container --></div>
</body>
</html>
There is also another file for the pop up

Code:

alert('Site might not work properly with pop up blockers! If IE and page does not load please set your security down to medium and reload the page.')
var getin = prompt("Please enter the code provided during class!","")
if (getin=="")
{
if (getin=="null")
{location.href='http://www.greenrealestateeducation.com/'}
else
if (getin!="")
{location.href='http://www.greenrealestateeducation.com/'}
}

jcdevelopment
07-17-2008, 03:03 PM
Try this one out, i have actually used this one.. along time ago though. Not sure if it still works but you can try it out



<script language="JavaScript" type="text/javascript">
var exp = 1; // the number at the left reflects the number of days for the cookie to last
// modify it according to your needs

function newCookie(name,value,days) {
if (days) {
var date = new Date();
date.setTime(date.getTime()+(days*24*60*60*1000));
var expires = "; expires="+date.toGMTString(); }
else var expires = "";
document.cookie = name+"="+value+expires+"; path=/"; }

function readCookie(name) {
var nameSG = name + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameSG) == 0) return c.substring(nameSG.length,c.length); }
return null; }

function amt() {
var num = readCookie('sancookie1')
if (num < 1) {
newCookie('sancookie1','testcookie1', exp);
SW=window.open('url.html','NewWin','toolbar=no,status=no,width=350,height=135,scrollbars')//you can adjust this if you need
SW.moveTo(190,240); }
}
//-->
</script>




BODY


<body onLoad="amt();">


Let me know

mcbc
07-17-2008, 03:26 PM
Hey, thanks that worked. Thank you.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum