PDA

View Full Version : Window AREA setting



monte2007
Sep 18th, 2007, 06:35 PM
Hi,

I downloaded a game call kidnap (zip file included) and wanted to modify the Window area where the images appears.


When you open the html file, there are 2 windows.

a Gold Window that has the Instructions

and

a WHITE WINDOW, where the pictures of the characters are located.



From the white windows which is set to (460,600) ..........all the images are confined to the TOP LEFT area.

My question is, How do I modify the SCRIPT so that those same images are SPREAD across the
OTHER areas of the window, such as the bottom part, or the far right.

Basically, I don't want the images to be confined to just one area.

I included the code, you don't necessary need to download the ZIP file.

thanks

Monte


here is the code
***********************************************


<html>

<body onload="ZeroNow()">

</body>

<script>

function ZeroNow(){
self.moveTo(0,0)
self.resizeTo(460,600)
}

News=open('','news','width=450,height=550,top=0,left=0,toolbar=no')
News.document.write("<html><body bgcolor=gold onblur='self.close()'>")
for(r=0;r<7;r++){
rand=Math.floor(Math.random()*24)
News.document.write("<img src=",rand,".gif> ")
}
News.document.write("<br><font face=Tahoma><h1>Hello Detective!</h1>There is a killer among our group of innocent looking people.<br>")
News.document.write("You are the chief detective police inspector. You are aware of the criminal's existence but need to identify him or her.<br>")
News.document.write("Every time you take someone in for interogation, the killer strikes, just to tease you...<br>")
News.document.write("Time is running out...Please get on with your job!<br><hr><br>")
News.document.write("Hint:<br>The killer is the only one that moves about, replacing the person he or she just eliminated.<br>")
News.document.write("Click on the person to bring in for interogation.<hr><br>")
News.document.write("<a href='javascript:opener.focus()'>START</a>")
News.document.write("</font></body></html>")
News.document.close()

PersNom=new Array("Ann Hall","Goldie Rouge","Mimi Fatts","Helen Redhedd","Gran May","Tom Saylor","Red Beard","Hank Toms","Johnny Hagg","Cecil Black","Gusto Bier","Father Nicholas","General Haig","Anthony Commie","Ian Canary","Little James","Boy George","Harry Junior","Canary Junior","Simon Lime","Marge Thick","Mrs. Bruno","Honey Blue","Mrs. Green","Mary Widower")
N=(navigator.appName.indexOf("Netscape")!=-1)
M=(navigator.appName.indexOf("Microsoft")!=-1)
Vis=new Array()
Vis[0]=(M) ? "hidden" : "hide"
Vis[1]=(M) ? "visible" : "show"
function GetDiv(divId,divY,divX,divW,divH,bCol,visb,zInd){
bkCol=(bCol!="")?((N)?" bgColor="+bCol:";background:"+bCol):""
DivTyp = (M) ? "<DIV" : "<LAYER"
if(M){Styl=" ID="+divId+" style='position:absolute;top:"+divY+";left:"+divX+";width:"+divW+";height:"+divH+bkCol+";visibility:"+Vis[visb]+";z-index:"+zInd+"'>"}
if(N){Styl=" ID="+divId+" top="+divY+" left="+divX+" width="+divW+" height="+divH+bkCol+" visibility="+Vis[visb]+" z-index="+zInd+">"}
document.writeln(DivTyp+Styl)
}
function EndDiv(){
(M)? document.writeln("</DIV>"): document.writeln("</LAYER>")
}

spy=Math.floor(Math.random()*25)
spypos=spy
kill=0
removeme=0
iden=0
warn=""
Reper=new Array("The teacher of ","The psychotic neighbor of ","The man who usually drinks beers next to ","An idiot who hates ","Grand-mother-in-law of ","The sailor who frequents ","The father of the boyfriend of ")
Sexs=new Array("the chubby woman","the bearded man","the gentleman","the boy","the grumpy woman")
Asked=new Array()
Hts=new Array()
for(ht=0;ht<25;ht++){Hts[ht]=ht;Asked[ht]=0}
shuf=new Array()
x=0
while(x<25){

ran=Math.floor(Hts.length*Math.random())
shuf[x]=Hts[ran]
if(shuf[x]==spy) removeme=x
Fst=Hts.slice(0,ran)
Snd=Hts.slice(ran+1)
Hts=Fst.concat(Snd)
x++
}

AvailPos=shuf
Fst=AvailPos.slice(0,removeme)
Snd=AvailPos.slice(removeme+1)
AvailPos=Fst.concat(Snd)


for(dept=0;dept<5;dept++){
for(mem=0;mem<5;mem++){
num=dept*5+mem
divId="div"+num
GetDiv(divId,10+dept*50,20+mem*50,10,10,'',1,dept*5+mem)
document.write("<a href='javascript:CheckHim(",num,")'><img src=",shuf[dept*5+mem],".gif border=0></a>")
EndDiv()
}
}

GetDiv('Hint',440,75,200,30,'',1,0)
document.write("<a href='javascript:Hint()'>Help</a> &nbsp;&nbsp;&nbsp;")
document.write("&nbsp;&nbsp; <a href='http://www.caoxuan.com/zip4free/request.html' target=_blank>Download</a>")
EndDiv()


function CheckHim(x){
ZeroNow()
Asked[x]++
times=Asked[x]
iden=x
if(x==spy){Win();return}
SpyMove()
}
Intro="HELP? Are you kidding? You're the police and you want help?\n\n"
Intro+="There is a psycho-killer in this group of people.\nHe or she moves about in the neighborhood knocking off people, one by one.\n"
Intro+="Every time you, the chief inspector, take someone in for investigation,\nthe killer would carry out the evil deed, just to tease you.\n"
Intro+="Take a careful look at the people. Remember where everyone is.\n\nThe one that moves about is the killer!"
function Hint(){alert(Intro)}



function SpyMove(){
News=open('','news','width=450,height=550,top=0,left=0,toolbar=no')
News.document.write("<html><body onblur='self.close()'><font face=Tahoma><center>")
News.document.write("<a href='javascript:opener.focus()'>CONTINUE</A><br><hr>")
News.document.write("This is the ",times," times you interogate<br><img src=",shuf[iden],".gif><br><b>")
warn=""
if(times>2) warn="<br><font color=red><b>Stop harrassing this person!</font></b>"
if(times>3) warn="<br><font color=red><b>Leave this one alone!</font></b>"
if(times>4) warn="<br><font color=red><b>Hey, CRAZY COP! Leave this one alone!</font></b>"
if(times>5) warn="<br><font color=red><b>What is your problem? Are you sick?<br>Leave this one alone!</font></b>"
if(times>6) warn="<br><font color=red><b>HEY STUPID!<br>Leave this one alone!</font></b>"
News.document.write(PersNom[shuf[iden]],"</b><br>who is not a killer!<br>Just look at this person! Does this look like a killer?",warn,"<br>Please catch the killer quickly!!!<hr>")
if(kill>0){
News.document.write("<font size=4>MORE BAD NEWS!!!<br>",kill," reported missing!</font><br>")
News.document.write(Reper[Math.floor(Math.random()*Reper.length)],PersNom[shuf[spypos]],"<br>")
News.document.write("<img src=",shuf[spypos],".gif><br>")
News.document.write("reports that ",Sexs[Math.floor(shuf[spypos]/5)]," is missing!!!<br><hr>")
}
News.document.write("<a href='javascript:opener.focus();self.close()'>CONTINUE</A></font></body></html>")
News.document.close()
News.focus()
ran=Math.floor(Math.random()*AvailPos.length)
spypos=AvailPos[ran]
Fst=AvailPos.slice(0,ran)
Snd=AvailPos.slice(ran+1)
AvailPos=Fst.concat(Snd)
t=Math.floor(spypos/5)
l=spypos%5
if(M){
document.all["div"+spypos].style.visibility='hidden'
document.all["div"+spy].style.top=10+t*50
document.all["div"+spy].style.left=20+l*50
document.all["div"+spy].style.zIndex=spypos
}
if(N){
document.layers["div"+spypos].visibility='hide'
document.layers["div"+spy].top=10+t*50
document.layers["div"+spy].left=20+l*50
document.layers["div"+spy].zIndex=spypos
}

kill++
if(kill>23)Lose()
}



function Win(){
News=open('','news','width=450,height=550,top=0,left=0,toolbar=no')
News.document.write("<html><body bgcolor=gold><font face=Tahoma><center><h1>NEWS!!!<br>KIDNAPPER CAUGHT!!!<BR>")
News.document.write("<hr><br>")
News.document.write(PersNom[shuf[spy]],"<br><img src=",shuf[spy],".gif><br>is THE killer! CONGRATULATIONS, DETECTIVE!<hr><br>")
News.document.write("<font size=2>By the way, <b>",kill,"</b> were dead before you got the psycho!<br><br>")
News.document.write("<a href='javascript:self.close();opener.location.reload()'>NEW GAME</A></font></body></html>")
News.document.close()
News.focus()
}


function Lose(){
News=open('','news','width=450,height=550,top=0,left=0,toolbar=no')
News.document.write("<html><body bgcolor=gold><font face=Tahoma><center><h1>OH NO!!!<br>EVERYONE'S DEAD!!!</h1><BR>")
News.document.write("<hr><br><font size=4>")
News.document.write("Who would ever suspect<br><img src=",shuf[spy],".gif><br><b>",PersNom[shuf[spy]],"</b><br>as THE killer!<br>Anyway, ...<br>YOU'RE SACKED, DETECTIVE!<hr><br>")
News.document.write("<a href='javascript:self.close();opener.location.reload()'>NEW GAME</A></font></font></body></html>")
News.document.close()
News.focus()
}
</script>
</html>