Hey I need help on how to do this:
Once the health goes down to 0 % then I want a pop up box to come up saying something like 'YOU WIN!'
You can see it so far here:
http://www.freewebs.com/imedz/Battle...ine%20Test.htm
Printable View
Hey I need help on how to do this:
Once the health goes down to 0 % then I want a pop up box to come up saying something like 'YOU WIN!'
You can see it so far here:
http://www.freewebs.com/imedz/Battle...ine%20Test.htm
You'll have to do an if statement and then you make an alert in it.
It would have to detect when the last image is shown, and then it makes the alert.
I guess you could do something like this (wrap your last image in a layer tag):
Not sure if it would work, just a guess though.Code:if(document.the_last_images_layer_id.visibility = "true")
{
document.the_last_images_layer_id.alert("hai der")
}
if (statement_for_last_image_selected)
{
alert("You Win!");
}
EDIT:
[code]
<html>
<head>
<style type="text/css" media="all">
body {
margin: 0;
padding: 0;
color: #000;
font-family: Tahoma;
font-size: 12px;
background-color: #CCCCCC;
}
.header {
background-color: #9A060B;
color: #FFF;
font-size: 12pt;
font-weight: bold;
padding: 2px;
border-bottom: 1px solid #000;
}
td.content {
background-color: #FFF;
color: #000;
border: none;
font-size: 12px;
vertical-align: top;
margin-top:0;
padding: 2px;
}
.style1 {
font-size: 36px;
font-weight: bold;
font-family: Tahoma;
color: #FFFFFF;
}
body,td,th {
color: #666666;
font-family: Tahoma;
font-size: 13px;
}
a:link {
color: #0099FF;
text-decoration: none;
}
a:visited {
color: #0099FF;
text-decoration: none;
}
a:hover {
color: #FF0000;
text-decoration: underline;
}
a:active {
color: #0099FF;
text-decoration: none;
}
</style>
<script type="text/javascript">
<!--
/* define image width and height */
var pic_width=260;
var pic_height=64;
/* define text to show on button */
var button_text="Attack 1";
/* define image urls */
if (document.images)
{
pic1= new Image(pic_width,pic_height);
pic1.src="http://www.freewebs.com/iMedz/Images/Health%20Bar.bmp";
pic2= new Image(pic_width,pic_height);
pic2.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D15.bmp";
pic3= new Image(pic_width,pic_height);
pic3.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D30.bmp";
pic4= new Image(pic_width,pic_height);
pic4.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D50.bmp";
pic5= new Image(pic_width,pic_height);
pic5.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D70.bmp";
pic6= new Image(pic_width,pic_height);
pic6.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D85.bmp";
pic7= new Image(pic_width,pic_height);
pic7.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D90.bmp";
pic8= new Image(pic_width,pic_height);
pic8.src="http://www.freewebs.com/imedz/Images/Health%20Bar%20%2D100.bmp";
}
var pics= new Array(8)
pics[0]=pic1.src;
pics[1]=pic2.src;
pics[2]=pic3.src;
pics[3]=pic4.src;
pics[4]=pic5.src;
pics[5]=pic6.src;
pics[6]=pic7.src;
pics[7]=pic8.src;
var numpics=8;
var thenum=0;
imgName="img1";
function change_it()
{
if (document.images)
{
document.write("<IMG SRC='"+pics[thenum]+"' border='0' width='"+pic_width+"' height='"+pic_height+"' name='img1'>\n");
document.write("<BR><FORM><INPUT TYPE='button' value='"+button_text+"' onClick='change_it2()'></FORM>");
}
}
function change_it2()
{
var x=0;
thenum+=1;
if (thenum>numpics-1)
{
document[imgName].src=pics[0];
thenum=0;
}
else
{
document[imgName].src=pics[thenum];
x+=1;
}
if (thenum == 7)
{
alert('You Win!');
document.location.href='';
}
}
//-->
</script>
<body bgcolor="black | #000000">
<link rel="icon" href="www.freewebs.com/imedz/logo.jpg" type="image/jpg">
<title>Medabots Online| More Medabots more power</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width=800 border=0 align="center" cellpadding=0 cellspacing=0>
<tr>
<td colspan=6>
<img src="images/fv_01.jpg" width=800 height=14 alt="" /></td>
</tr>
<tr>
<td rowspan=6 background="images/fv_02.jpg"> </td>
<td colspan=3 background="images/fv_03.jpg"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0">
<tr>
<td width="12%"> </td>
<td width="88%"> </td>
</tr>
<tr>
<td> </td>
<td><span class="style1"> </span></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table></td>
<td>
<img src="images/fv_04.jpg" alt="" width=20 height=117 border="0" /></a></td>
<td rowspan=6 background="images/fv_05.jpg"> </td>
</tr>
<tr>
<td height="37" colspan=4 background="images/fv_06.jpg"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%">
<div align="center">
<strong><a href="index.htm">
<font color="#000000">Home</font>
</a></strong></div></td>
<td width="20%"><div align="center"><strong><a href="login.htm">
<font color="#000000">Login</font></a></strong></div></td>
<td width="20%"><div align="center"><strong><a href="Register.htm">
<font color="#000000">Register</font></a></strong></div></td>
<td width="20%"><div align="center"><strong><a href="Forums.htm">
<font color="#000000">Forums</font></a></strong></div></td>
<td width="20%"><div align="center"><strong><a href="Downloads.htm">
<font color="#000000">Downloads</font></a></strong></div></td>
</tr>
</table></td>
</tr>
<tr>
<td height="22" colspan=4 background="images/fv_07.jpg"> </td>
</tr>
<tr>
<td background="images/fv_08.jpg" class="content"><strong>
<font color="#000000"><A href="http://www.freewebs.com/imedz/Index.htm">
<font color="#000000">Home</font></A></font></strong></a><br>
<strong><font color="#000000"><A href="Login.htm">
<font color="#000000">Login</font></A></font></strong></a><br>
<strong><font color="#000000"><A href="Register.htm">
<font color="#000000">Register</font></A></font></strong></a><br>
<strong><font color="#000000"><A href="announcements.htm">
<font color="#000000">Announcements</font></A></font></strong></a><br>
<strong><font color="#000000"><A href="Chat Room.htm">
<font color="#000000">Chat Room</font></A></font></strong></a><br>
<strong><font color="#000000"><A href="mailto:Medz03@hotmail.com">
<font color="#000000">Contact Us</font></A><br> </font></strong></a> <br>
<a href="#"><strong><font color="#000000"></font></strong></a><br>
<a href="#"><strong><font color="#000000"></font></strong></a><br>
</p></td>
<td background="images/fv_09.jpg" align="center"> </td>
<td height="465" colspan=2 background="images/fv_10.jpg" class="content" align="center"><table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td>
<p align="center"> <b>Welcome!</b></td>
</tr>
</table>
<p><strong><a href="#"><font color="#000000">W</font></a><font color="#000000">elcome
to Medabots Online!</font></strong></p>
<p align="left"><img src="http://tasanen.com/kuvat/30x1px.gif" width="50" />
<img src="http://i265.photobucket.com/albums/ii211/M3DZ03/Metabee.jpg" border="0">
<img src="http://tasanen.com/kuvat/30x1px.gif" width="350" />
<img border="0" src="http://www.freewebs.com/iMedz/images/Rokusho.bmp"></p>
<p align="left">
<img height="64" src="http://www.freewebs.com/iMedz/Images/hp%20full.bmp" width="260" border="0" name="img2">
<img height="64" src="http://www.freewebs.com/iMedz/Images/Health%20Bar.bmp" width="260" border="0" name="img1"></p>
<p align="left">
<input onClick="change_it2()" type="button" value="Missle" name="Attack 1"></p>
<p align="left">
<input onClick="change_it2()" type="button" value="Revolver" name="Attack 3"> </p>
<p align="left">
<input onClick="change_it2()" type="button" value="Submachinegun" name="Submachinegun"> </p>
<p align="left">
<input name="btnG" value="Defend" type="reset"><span id="ap"> </span> </p>
<p> </td>
</tr>
<tr>
<td height="32" colspan=4 background="images/fv_11.jpg"> </td>
</tr>
<tr>
<td colspan=4>
<img src="images/fv_12.jpg" width=769 height=13 alt="" /></td>
</tr>
<tr>
<td>
<img src="images/spacer.gif" width=15 height=1 alt="" /></td>
<td>
<img src="images/spacer.gif" width=164 height=1 alt="" /></td>
<td>
<img src="images/spacer.gif" width=31 height=1 alt="" /></td>
<td>
<img src="images/spacer.gif" width=554 height=1 alt="" /></td>
<td>
<img src="images/spacer.gif" width=20 height=1 alt="" /></td>
<td>
<img src="images/spacer.gif" width=16 height=1 alt="" /></td>
</tr>
</table>
<div style="font-size: 0.8em; text-align: center; margin-top: 1.0em; margin-bottom: 1.0em;">
Umm where should I put them?
Thats the 'Battle Test Engine.html'
Its way better if you register at http://000webhost.com/
No ads, much space, fast(er).
Transfer all your freewebs files to that and ur set.
Yeh I already have 000webhost but im transfering my pages so im still using freewebs to edit for now. and thx for taking th ebanner out i was meaning to do that...