Hi there,
Can anyone explain me how Where I can use GetDiv(aaa,100,200,50-1,1) ..EndDiv?
What does all that mean?
Actally I know a lot about javascript but this is the first time I came across this?
thanks for helping
Printable View
Hi there,
Can anyone explain me how Where I can use GetDiv(aaa,100,200,50-1,1) ..EndDiv?
What does all that mean?
Actally I know a lot about javascript but this is the first time I came across this?
thanks for helping
As far as I'm aware, there is no function called GetDiv in Javascript. I did a quick Google search and all I got were Javascripts with their own implementations of similarly named functions.
hi again,
it is not a function .I got it from a javascript game called "HANGMAN"
GetDiv(...,200,100,50,50,1,0)
<img src=*.jpg">
EndDiv
it was something like this....
if you can not guess the correct letter an image become visible..in the game
thanks
Well, then, how should we know how to use it? Can you tell us where this hangman game is?
Hi again,
Here is the game that uses GetDiv....
<title>JAVASCRIPT - GAMES - www.caoxuan.com - hangman</title>
</head><style>
.formTxt{font: 15pt Arialblack}</style>
<script src=laydiv.js></script>
<script src=words.js></script>
<SCRIPT>
keySet=new Array()
theWord=Words[parseInt(Words.length*Math.random())]
cor=new Array
correct=0 hang=0 test=0
UsedKeys=""
GetDiv('div0',300,50,10,10,'',0,0)
document.write("<img src='0.gif'>")
EndDiv()
GetDiv('div1',90,50,10,10,'',0,0)
document.write("<img src='1.gif'>")
EndDiv()
GetDiv('div2',80,115,10,10,'',0,0)
document.write("<img src='2.gif'>")
EndDiv()
GetDiv('div3',130,120,10,10,'',0,0)
document.write("<img src='3.gif'>")
EndDiv()
GetDiv('div4',170,120,10,10,'',0,0)
document.write("<img src='4.gif'>")
EndDiv()
GetDiv('div5',200,120,10,10,'',0,0)
document.write("<img src='5.gif'>")
EndDiv()
GetDiv('div6',200,225,10,10,'',0,0)
document.write("<img src='6.gif'>")
EndDiv()
GetDiv('div7',200,239,10,10,'',0,0)
document.write("<img src='7.gif'>")
EndDiv()
GetDiv('div8',235,110,10,10,'',0,0)
document.write("<img src='8.gif'>")
EndDiv()
GetDiv('div9',235,230,10,10,'',0,0)
document.write("<img src='9.gif'>")
EndDiv()
document.write("<form><table width=650><tr><td align=center><font face=Tahoma><h1>HANGMAN</h1></font><tr><td align=center>")
for(x=0;x<theWord.length;x++){
document.write("<input class='formTxt' type=text size=1 value='' readonly>")
}
document.write("<tr><td align=center><img src=blnk.gif width=650 height=220>")
document.write("<tr><td align=center><font face=Tahoma size=1>This is a ",theWord.length,"-letter word.<br>")
document.write("Try to guess and press the alphabet keys on your keyboard<br>You have 10 guesses<br>If the hangman sketch is complete, you lose.<p>")
document.write("(If you want the this game for your site, ")
document.write("<a href='http://www.caoxuan.com/zip4free/request.html' target=_blank>ask Kien</a> for the zip files)</font>")
document.write("</table></form>")
document.close()
if(document.layers) document.captureEvents(Event.KEYPRESS);
document.onkeypress=GetKey
function GetKey(e){
ok=0
if(N||S){
theKey=e.which;
Akey=String.fromCharCode(theKey)
}
if(M){
theKey=window.event.keyCode;
Akey=String.fromCharCode(theKey)
}
if(theKey<97)theKey+=32
for(k=0;k<keySet.length;k++){
if(keySet[k]==theKey)return false
}
keySet[test]=theKey
test++
for(x=0;x<theWord.length;x++){
if(cor[x]==1)x++
if(theWord.charCodeAt(x)==theKey){ok=1;document.forms[0].elements[x].value=theWord.charAt(x);cor[x]=1;correct++}
}
if(ok==0){
hang++
ShowHide("div"+(hang-1),1)
UsedKeys+=Akey+", "
if(hang>9)Lose()
}
if(correct>=theWord.length)Win()
}
function Win(){
alert("Great job! You Win!\nClick OK to start new game.\n\nWrong letters: "+UsedKeys)
document.forms[0].reset()
location.reload()
}
function Lose(){
alert("Sorry! You Lose!\n\nThe word is * "+theWord+" *\n\nClick OK to start new game.\n\nWrong letters: "+UsedKeys)
document.forms[0].reset()
location.reload()
}
</script>
<body bgcolor=silver></body>
</html>
I assume that the functions are inside laydiv.js.
Here's the function:
basically that function makes code to start off a DIV.Code:function GetDiv(divId,divY,divX,divW,divH,bCol,visb,zInd){
bkCol=(bCol!="")?((N)?" bgColor="+bCol:";background:"+bCol):""
Styl = (M||S) ? "<DIV" : "<LAYER"
if(M||S){
Styl+=" ID="+divId
Styl+=" style='position:absolute;top:"+divY+";left:"+divX+";width:"+divW+";height:"+divH+bkCol
Styl+=";visibility:"+Vis[visb]+";z-index:"+zInd
Styl+="'>"
}
All the functions used are here