Ja po i postoj do javascripts me nje vend (game javascript)
Kodi:
<!-- THREE STEPS TO INSTALL ANTS:
1. Copy the coding into the HEAD of your HTML document
2. Add the onLoad event handler into the BODY tag
3. Put the last coding into the BODY of your HTML document -->
<!-- STEP ONE: Paste this code into the HEAD of your HTML document -->
<HEAD>
<style type="text/css">
.ant {
height: 16px;
position: absolute;
visibility: hidden;
width: 16px;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!-- Original: Mike Hall (MHall75819@aol.com) -->
<!-- Web Site:
http://members.aol.com/MHall75819 -->
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!!
http://javascript.internet.com -->
<!-- Begin
var dir = "http://www.your-web-site-address-here.com/where-you-put-the-ant-images/";
// get the ant images in a single zip file from
//
http://javascript.internet.com/img/ants/ants.zip// Extract the images then upload them to your server and
// change the 'dir' variable to their location (end with a '/')
var images = new Array(
dir+"antdl.gif",
dir+"antdn.gif",
dir+"antdr.gif",
dir+"antlt.gif",
dir+"antrt.gif",
dir+"antul.gif",
dir+"antup.gif",
dir+"antur.gif"
);
var isMinNS4 = (document.layers) ? 1 : 0;
var isMinIE4 = (document.all) ? 1 : 0;
var _LBimgList;
var _LBimgCount;
var _LBbase = "LBbase";
var _LBlow = "LBlow";
var _LBhigh = "LBhigh";
var _LBwidth;
var _LBheight;
var _LBbaseLayer;
var _LBlowLayer;
var _LBhighLayer;
function createLoadBar(width, height, bdSize, bdColor, bgColor, fgColor, fontFace, fontSize, text) {
var txtLow, txtHigh, tblStart, tblEnd;
var str;
txtLow = '<font color="' + fgColor + '" face="' + fontFace + '" size=' + fontSize + '>' + text + '</font>';
txtHigh = '<font color="' + bgColor + '" face="' + fontFace + '" size=' + fontSize + '>' + text + '</font>';
tblStart = '<table border=0 cellpadding=0 cellspacing=0 height=100% width=100%><tr valign="center"><td align="center">';
tblEnd = '</td></tr></table>';
if (isMinNS4)
str = '<layer name="' + _LBbase + '" bgcolor="' + bdColor + '" width=' + width + ' height=' + height + ' visibility="hide">\n'
+ ' <layer name="' + _LBlow + '" bgcolor="' + bgColor + '" left=' + bdSize + ' top=' + bdSize + ' width=' + (width - 2 * bdSize) + ' height=' + (height - 2 * bdSize) + '>' + tblStart + txtLow + tblEnd + '</layer>\n'
+ ' <layer name="' + _LBhigh + '" bgcolor="' + fgColor + '" left=' + bdSize + ' top=' + bdSize + ' width=' + (width - 2 * bdSize) + ' height=' + (height - 2 * bdSize) + '>' + tblStart + txtHigh + tblEnd + '</layer>\n'
+ '</layer>';
if (isMinIE4)
str = '<div id="' + _LBbase + '" style="position:absolute; background-color:' + bdColor + '; width:' + width + 'px; height:' + height + 'px; visibility:hidden;">\n'
+ ' <div id="' + _LBlow + '" style="position:absolute; background-color=' + bgColor + '; left:' + bdSize + 'px; top:' + bdSize + 'px; width:' + (width - 2 * bdSize) + 'px; height:' + (height - 2 * bdSize) + 'px;">' + tblStart + txtLow + tblEnd + '</div>\n'
+ ' <div id="' + _LBhigh + '" style="position:absolute; background-color=' + fgColor + '; left:' + bdSize + 'px; top:' + bdSize + 'px; width:' + (width - 2 * bdSize) + 'px; height:' + (height - 2 * bdSize) + 'px;">' + tblStart + txtHigh + tblEnd + '</div>\n'
+ '</div>';
document.writeln(str);
_LBwidth = width - 2 * bdSize;
_LBheight = height - 2 * bdSize;
}
function startLoadBar(srcList, x, y) {
var i, w, h;
if (isMinNS4) {
_LBbaseLayer = document.layers[_LBbase];
_LBlowLayer = _LBbaseLayer.document.layers[_LBlow];
_LBhighLayer = _LBbaseLayer.document.layers[_LBhigh];
}
if (isMinIE4) {
_LBbaseLayer = eval('document.all.' + _LBbase);
_LBlowLayer = eval('document.all.' + _LBlow);
_LBhighLayer = eval('document.all.' + _LBhigh);
}
if (isMinNS4) {
w = window.innerWidth;
h = window.innerHeight;
}
if (isMinIE4) {
w = document.body.clientWidth;
h = document.body.clientHeight;
}
if (x == null)
x = Math.round((w - _LBwidth) / 2);
if (y == null)
y = Math.round((h - _LBheight) / 2);
moveLayerTo(_LBbaseLayer, x, y);
clipLayer(_LBhighLayer, 0, 0, 0, _LBheight);
showLayer(_LBbaseLayer);
_LBimgCount = 0;
_LBimgList = new Array();
for (i = 0; i < srcList.length; i++) {
_LBimgList[i] = new Image();
_LBimgList[i].onabort = _LBupdate;
_LBimgList[i].onerror = _LBupdate;
_LBimgList[i].onload = _LBupdate;
}
for (i = 0; i < srcList.length; i++)
_LBimgList[i].src = srcList[i];
}
function endLoadBar() { // empty (can be changed) function called when finished
}
function _LBupdate() {
var pct;
_LBimgCount++;
pct = _LBimgCount / _LBimgList.length;
clipLayer(_LBhighLayer, 0, 0, Math.round(pct * _LBwidth), _LBheight);
if (_LBimgCount == _LBimgList.length) {
setTimeout('hideLayer(_LBbaseLayer)', 500);
endLoadBar();
}
}
function moveLayerTo(layer, x, y) {
if (isMinNS4)
layer.moveTo(x, y);
if (isMinIE4) {
layer.style.left = x;
layer.style.top = y;
}
}
function hideLayer(layer) {
if (isMinNS4)
layer.visibility = "hide";
if (isMinIE4)
layer.style.visibility = "hidden";
}
function getWindowWidth() {
if (isMinNS4)
return(window.innerWidth);
if (isMinIE4)
return(document.body.offsetWidth);
return(-1);
}
function getWindowHeight() {
if (isMinNS4)
return(window.innerHeight);
if (isMinIE4)
return(document.body.offsetHeight);
return(-1);
}
function getPageScrollX() {
if (isMinNS4)
return(window.pageXOffset);
if (isMinIE4)
return(document.body.scrollLeft);
return(-1);
}
function getPageScrollY() {
if (isMinNS4)
return(window.pageYOffset);
if (isMinIE4)
return(document.body.scrollTop);
return(-1);
}
function getHeight(layer) {
if (isMinNS4) {
if (layer.document.height)
return(layer.document.height);
else
return(layer.clip.bottom - layer.clip.top);
}
if (isMinIE4) {
if (false && layer.style.pixelHeight)
return(layer.style.pixelHeight);
else
return(layer.clientHeight);
}
return(-1);
}
function getWidth(layer) {
if (isMinNS4) {
if (layer.document.width)
return(layer.document.width);
else
return(layer.clip.right - layer.clip.left);
}
if (isMinIE4) {
if (layer.style.pixelWidth)
return(layer.style.pixelWidth);
else
return(layer.clientWidth);
}
return(-1);
}
function getLeft(layer) {
if (isMinNS4)
return(layer.left);
if (isMinIE4)
return(layer.style.pixelLeft);
return(-1);
}
function getTop(layer) {
if (isMinNS4)
return(layer.top);
if (isMinIE4)
return(layer.style.pixelTop);
return(-1);
}
function getRight(layer) {
if (isMinNS4)
return(layer.left + getWidth(layer));
if (isMinIE4)
return(layer.style.pixelLeft + getWidth(layer));
return(-1);
}
function getBottom(layer) {
if (isMinNS4)
return(layer.top + getHeight(layer));
else if (isMinIE4)
return(layer.style.pixelTop + getHeight(layer));
return(-1);
}
function moveLayerBy(layer, dx, dy) {
if (isMinNS4)
layer.moveBy(dx, dy);
if (isMinIE4) {
layer.style.pixelLeft += dx;
layer.style.pixelTop+= dy;
}
}
function showLayer(layer) {
if (isMinNS4)
layer.visibility = "show";
if (isMinIE4)
layer.style.visibility = "visible";