<html>
<head>
<title>א"ב בבנית אתרים</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-8">
<SCRIPT>
var object
//make an array called xx and give it 101 elements
xx=new Array(101)
//element 0=0, element 1=1, element 2=2 ....element 100=100
//the "for" operator is used to loop from 0
to a hundred, naming the array elements
//this is a good way to declare multiple elements without have to write
them out
function makeArray(){
for (i=0;i<101;i++){xx[i]=i}
//there are three objects in the body, object1, object2,
and object3 which will be moved
//in an orderly fashion
setObject()
}
ob=0
function setObject(){
ob+=1
if (ob<4){ object="object"+ob
j=0;
moveObject()}
}
//the script above calls moveObject where the eval function is used
j=0
function moveObject(){
j+=1
// the eval function is like glue ... it brings the various pieces of
the script together
// the three variables that need to be joined are
// 1. the object which is either object 1, 2 or 3
// 2. the browser text, note that it varies from Netscape to Internet
Explorer
// 3. the value of the array which is a number from 0 to 100 (+10 to adjust
for current text location)
// The eval() function strings where necessary and keeps numbers when
needed and even performs
// math functions while connecting strings and interpreting variabes.
// document.all checks for IE and document.layers checks for Netscape
if (document.all)eval(object+".style.left="+(xx[j]+20))
if (document.layers)eval("document."+object+".left="+(xx[j]+20));
if (j<100) setTimeout("moveObject()",20)
else setObject()
}
// objects are made with setObect until object 4 is encountered,
and the script stops running
</SCRIPT>
<link rel="stylesheet" href="../liora3.css">
</head>
<BODY onload=makeArray()>
<DIV id=object1
style="LEFT: 10px; POSITION: absolute; TOP: 50px; Z-INDEX: 2">This
is a demo of
making an array</DIV>
<DIV id=object2
style="LEFT: 10px; POSITION: absolute; TOP: 75px; Z-INDEX: 2">and
using it to
move text with the eval() function</DIV>
<DIV id=object3
style="LEFT: 10px; POSITION: absolute; TOP: 100px; Z-INDEX: 2">right
click and
view source, or file, save as to read the tips in the html
file</DIV><table width="80%" border="1" cellspacing="2"
cellpadding="2" align="center" bgcolor="#ece8cf"
bordercolor="#666666" class="bord2">
<tr>
<td align="center"> תורוש תזזה</td>
<tr>
<td align="left"> <br>
<br>
<br><br><br>
</td>
<tr>
<td align="left"> </td>
</table>
</body>
</html>
|