Print Page | Close Window

Javascript trouble

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: General Discussion
Forum Description: General discussion and chat on any topic.
URL: https://forums.webwiz.net/forum_posts.asp?TID=4714
Printed Date: 29 March 2026 at 5:00pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Javascript trouble
Posted By: faubo
Subject: Javascript trouble
Date Posted: 03 August 2003 at 5:16pm

I have two pieces of javascript and I need to mix them, but I suck in javascript much more than in asp... so you can imagine...

I want to launch this popunder if I do not have a cookie.

<script>
var stillHome="yes";
function popUnder(){
pU=window.open("popunder.html","pU","top=10000,left=10000,width=10,height=10");
}
if (navigator.userAgent.indexOf("Netscape")!= -1){}
else if (navigator.userAgent.indexOf("Mozilla")!= -1){
if (navigator.appVersion.indexOf("4")!= -1){
if (navigator.appName.indexOf("Netscape")!= -1){
popUnder();;}}
else {}}
if (navigator.userAgent.indexOf("Opera")!= -1){ popUnder();}
else if (navigator.userAgent.indexOf("MSIE")!= -1){ popUnder();}
self.focus();
</script>

 

The cookie code is:

var win=null;
function NewWindow(mypage,myname,w,h,pos,infocus){
if(GetCookie("sid") == "999"){return;}
document.cookie="sid=999; Path=/; Expires= " + getFuture(7);
//the number "7" is the number of the days until the cookie expire

if(pos=="random"){myleft=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;mytop=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
if(pos=="center"){myleft=(screen.width)?(screen.width-w)/2:100;mytop=(screen.height)?(screen.height-h)/2:100;}
else if((pos!='center' && pos!="random") || pos==null){myleft=0;mytop=20}
settings="width=" + w + ",height=" + h + ",top=" + mytop + ",left=" + myleft + ",scrollbars=yes,location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no";win=window.open(mypage,myname,settings);
//above are the settings of the pop-up
win.focus();}

the function getFuture(f), function GetCookie (name), function getCookieVal (offset) are working fine

I'm fooling around with this code for ever and never get what I want... (to work). If some of you take the trouble to look at the code above and help me, I would be more than glad. These are the orginal separete codes that I need to mix together.

Thanks a lot!



-------------
http://www.conhecerparaconservar.org - I don't know how to make you click here



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net