Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Javascript trouble
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Javascript trouble

 Post Reply Post Reply
Author
faubo View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 May 2002
Location: Brazil
Status: Offline
Points: 560
Post Options Post Options   Thanks (0) Thanks(0)   Quote faubo Quote  Post ReplyReply Direct Link To This Post Topic: Javascript trouble
    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!



Edited by faubo
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.