1 Puzzle game help! Wed Jul 14, 2010 4:48 am
Unknown Data
Registered Member
Hello Guest.
I'm making a game to my site, and it's a kind of special.
First of all, this i my code (See the script in action here).
2. When someone is done with the game and solved the puzzle a alert PopUp will show up, standing you're done and how many attempt there is used.
Thanks for helping in advance!
~Unknown Data
I'm making a game to my site, and it's a kind of special.
First of all, this i my code (See the script in action here).
- Code:
<BODY onLoad="checkit()">
<SCRIPT LANGUAGE="JavaScript">
<!--
var temp = new Image()
var loc
var gotit
function checkit()
{
if ((navigator.appName=="Microsoft Internet Explorer")
&& (parseInt(navigator.appVersion) >= 4))
return
else
alert("For at spille skal du have IE4 eller bedre version")
}
function exch()
{
if ((event.button == 1) && (event.srcElement.className == "drag"))
{
if (gotit == 1)
{
gotit = 0
document.images[loc].src = document.images[event.srcElement.name].src
document.images[event.srcElement.name].src = temp.src
}
else
{
gotit = 1
loc = event.srcElement.name
temp.src = document.images[loc].src
}
}
}
document.onmousedown=exch
// -->
</SCRIPT>
<CENTER>
<NOSCRIPT>
To play this game, you need IE 4 or greater
</NOSCRIPT>
<div onclick="addItem('counttuna');">
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" STYLE="border:15px ridge gold">
<TR>
<TD><IMG SRC="http://img683.imageshack.us/img683/3106/112iq.png" WIDTH="120" HEIGHT="112" NAME="pic1" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img96.imageshack.us/img96/3397/111sag.png" WIDTH="120" HEIGHT="112" NAME="pic2" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img9.imageshack.us/img9/5897/21202531.png" WIDTH="120" HEIGHT="112" NAME="pic3" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img683.imageshack.us/img683/543/116k.png" WIDTH="120" HEIGHT="112" NAME="pic4" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img94.imageshack.us/img94/194/76393277.png" WIDTH="120" HEIGHT="112" NAME="pic5" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img155.imageshack.us/img155/2774/27348778.png" WIDTH="120" HEIGHT="112" NAME="pic6" CLASS="drag" ALT=""></TD>
</TR>
<TR>
<TD><IMG SRC="http://img688.imageshack.us/img688/4016/114kb.png" WIDTH="120" HEIGHT="112" NAME="pic7" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img819.imageshack.us/img819/9982/68965468.png" WIDTH="120" HEIGHT="112" NAME="pic8" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img682.imageshack.us/img682/4308/118.png" WIDTH="120" HEIGHT="112" NAME="pic9" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img716.imageshack.us/img716/1051/53718267.png" WIDTH="120" HEIGHT="112" NAME="pic10" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img641.imageshack.us/img641/5090/113li.png" WIDTH="120" HEIGHT="112" NAME="pic11" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img257.imageshack.us/img257/2254/45222859.png" WIDTH="120" HEIGHT="112" NAME="pic12" CLASS="drag" ALT=""></TD>
</TR>
<TR>
<TD><IMG SRC="http://img257.imageshack.us/img257/4754/22027596.png" WIDTH="120" HEIGHT="112" NAME="pic13" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img805.imageshack.us/img805/8729/110.png" WIDTH="120" HEIGHT="112" NAME="pic14" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img714.imageshack.us/img714/4144/77678307.png" WIDTH="120" HEIGHT="112" NAME="pic15" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img42.imageshack.us/img42/5281/117c.png" WIDTH="120" HEIGHT="112" NAME="pic16" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img517.imageshack.us/img517/1672/115gu.png" WIDTH="120" HEIGHT="112" NAME="pic17" CLASS="drag" ALT=""></TD>
<TD><IMG SRC="http://img571.imageshack.us/img571/5560/78425124.png" WIDTH="120" HEIGHT="112" NAME="pic18" CLASS="drag" ALT=""></TD>
</TR>
</TABLE>
</div>
<BR>
</CENTER></BODY>
<script type="text/javascript">
function addItem(thecount){
document.getElementById(thecount).innerHTML = parseFloat(document.getElementById(thecount).innerHTML)+1;
}
</script>
<style>
div#box {position: absolute; top: 139px; left: 220px; border: 1px solid black; padding: 5px; width: 160px; font: 13px Verdana;}
</style>
<div id="box">
You have used <span id="counttuna">0</span> attempt.
</div>
2. When someone is done with the game and solved the puzzle a alert PopUp will show up, standing you're done and how many attempt there is used.
Thanks for helping in advance!
~Unknown Data
Last edited by Unknown Data on Thu Jul 15, 2010 5:11 pm; edited 1 time in total