To start off I’m a pretty novice javascript user, so here’s my problem. The website I’m working on has a frame to the left that lists a series of links that go to different “home” webpages. The frame on the left and a frame on the top stay on the page while the “home” pages load to the right of the page like this
| Top Frame
|__________________________
| page 1 |
| page 2 |
| page 3 | Webpage loads here
| page 4 |
| page 5 |
| page 6 |
I have set a popup page to come up when, for instance “page 5”, is clicked on. This popup shows up and tells the user some information. At the bottom of the popup window there is a button that when pressed creates a cookie that causes the popup to not show again. What I want is that when the next time the user goes and clicks on page 5, if they have the cookie, it just loads the page to the right as if the popup never existed. I have an “if, else” statement that checks if the user has the cookie then either loads the popup or loads the webpage. The only problem I’m having is that I can’t figure out how to just have the page load and not appear in a new window. Here is my javascript code by itself in a new .htm for test purposes.
<html>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=windows-1252″>
<title>Javascript Test</title>
<meta name=”Microsoft Theme” content=”newsitetheme 1011, default”>
<script language=”javascript”>
var expDate = new Date();
expDate.setTime(expDate.getTime()+365*24*60*60*1000); // one year
function setCookie(isName,isValue,dExpires){
document.cookie = isName+”=”+isValue+”;expires=”+dExpires.toGMTString();
}
function getCookie(isName){
cookieStr = document.cookie;
startSlice = cookieStr.indexOf(isName+”=”);
if (startSlice == -1){return false}
endSlice = cookieStr.indexOf(“;”,startSlice+1)
if (endSlice == -1){endSlice = cookieStr.length}
isData = cookieStr.substring(startSlice,endSlice)
isValue = isData.substring(isData.indexOf(“=”)+1,isData.length);
return isValue;
}
function Popup(){
if (!getCookie(‘pop1’))
{popWin1 = window.open(“PopUp.htm”,””,”scrollbars=yes”,”width=850,height=1700,top=400,left=500″)}
else {window.open=”page 5.htm”} //using page 5 as an example I’m using window.open but I want it to just load the page not popup
}
</script>
</head>
<body>
<p style=”margin-top: 0; margin-bottom: 1px” align=”center”>
<img border=”0″ src=”Button.gif” width=”86″ height=”70″ id=”Home” onclick=”Popup()”></p>
</body>
</html>
And this is added to the PopUp.htm page
<input type=button value=”Don’t show again” onclick=”opener.setCookie(‘pop1’,0,opener.expDate);self.close()”>
along with the javascript functions above. Sorry if this is confusing its hard not to be. ?