Click to See Complete Forum and Search --> : I need help with Window.open and arrays!!


ssj4opie
08-31-2003, 05:05 PM
The underlined text is the problem!!! near the bottom


<html>
<head>
<style type="text/css">
body{color:#ffff00;font-family:verdana;font-size:20px;}
a:link,a:visited,a:active{color:#0000ff;text-decoration:underline;font-family:verdana;font-size:20px;}
a:hover{color:#ff0000;text-decoration:none;font-family:verdana;font-size:20px;}
</style>
<title>thaonlyballa's killers Thugbuilder</title>
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var start=new Date();
start=Date.parse(start)/1000;
var counts=325;
function CountDown(){
var now=new Date();
now=Date.parse(now)/1000;
var x=parseInt(counts-(now-start),10);
if(document.form1){document.form1.clock.value = x;}
if(x>0){
timerID=setTimeout("CountDown()", 100)
}else{
location.href="http://www.geocities.com/goldwing64_2001/thugbuilder.html"
}
}
// End -->
</script>
<SCRIPT LANGUAGE="JavaScript">
<!--
window.setTimeout('CountDown()',100);
-->
</script>
</head>
<body bgcolor="#000000">

<script>
var popunder=new Array()
popunder[0]="???"
popunder[1]="???"
popunder[2]="???"
popunder[3]="???"
popunder[4]="???"
popunder[5]="???"
popunder[6]="???"
popunder[7]="???"
popunder[8]="???"
popunder[9]="???"
popunder[10]="???"
popunder[11]="???"
popunder[12]="???"
popunder[13]="???"

var winfeatures="width=800,height=600,scrollbars=1,resizable=1,toolbar=1,location=1,menubar=1,status=1,directories=1"

var once_per_session=0

function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // if cookie exists
offset += search.length
// set index of beginning of value
end = document.cookie.indexOf(";", offset);
// set index of end of cookie value
if (end == 400)
end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}

function loadornot(){
if (get_cookie('popunder')==''){
loadpopunder()
document.cookie="popunder=yes"
}
}

function loadpopunder(){
win2= while (popunder.length > 0) {window.open(popunder.pop(),"",winfeatures)}
win2.blur()
window.focus()
}

if (once_per_session==0)
loadpopunder()
else
loadornot()
</script>

<SCRIPT LANGUAGE="JavaScript">
var ran = Math.round(Math.random() * 899999) + 100000;
var lubid_string = "<img src=\"http://lubid.lycos.com/one.asp?site=members.tripod.lycos.com&ord=" + ran + "\" height=\"1\" width=\"1\">";
document.write(lubid_string);
</script>

<FORM NAME="form1">
You will meet another crew member of thaonlyballa's killers in
<INPUT TYPE="text" NAME="clock" SIZE="2" VALUE="325">
seconds.
</FORM>
<br>
Created By <a href="http://www.geocities.com/goldwing64_2001" target="_blank">ssj4opie


</body>
</html>

this is the code I am working with.......the underlined portion is the trouble.....can anyone help

P.S. I tired the person's idea before but it didn't help

P.S.S. I hid the URL's for a purpose....my real code has actual URL's

Gollum
09-01-2003, 03:08 AM
Well, looking at the piece of code I can see a few problems...

function loadpopunder()
{
win2= while (popunder.length > 0)
{
window.open(popunder.pop(),"",winfeatures)
}
win2.blur()
window.focus()
}

Firstly there is no return value from a while statement. I guess you really mean to have the win2= take the value of the window.open(). Also, you could put the win2.blur() inside the braces so that it gets called on every window that gets opened, not just the last (if there is one)

Lastly, each entry in the array popunder is assigned to "???" and is not changed before this function is called so the pages you are opening are rather meaningless at this point and may exhibit unpredictable behaviour.

ssj4opie
09-01-2003, 09:18 AM
Thanks for the help,Gollum, But when I tried the things you suggested my webpages still didn't popup.

and on another note

my real code doesn't have the "???" it has actual URL's

but if you could explain what I might have done wrong

here is that same snipit of code

__________________________________________________________

function loadpopunder()
{
win2= while (popunder.length > 0)
{
window.open(popunder.pop()," ",winfeatures)
}
win2.blur()
window.focus()
}

__________________________________________________________

could you tell me what I might have done wrong??

Thanks for all of your help!!

ssj4opie
09-02-2003, 10:34 AM
does anyone know what to do to help me???