View Full Version : div and functions

11-29-2005, 07:53 AM
I'm a biginner, and I can't understand the following script:
there are 1 line written on the screen from the script, then when the function orra is 'activated ' this line dissapears and the other 2 lines appears.

I wanted to not dissapear the first line, and I want in this way (with a function + other lines from outside the function)
What I'm missing ?( the browser is Explorer)

<body id='ez' >

var orak= new Array(16)
for (i=0;i<11;i++)

function orra() {
document.write('<div id="masik" style="position:absolute;top:'+yy+'px;left:'+xx+';px;height:10px;width:10px">'+orak[10]+'</div>')
document.write('<div id="masik" style="position:absolute;top:50px;left50;px;height:10px;width:10px">'+orak[9]+'</div>')

document.write('<div id="masik" style="position:absolute;top:20px;left20;px;height:10px;width:10px">'+orak[8]+'</div>')

11-29-2005, 08:46 AM
I confess I don't understand your code either :cool:

What is the use of that array, as long as you use a number? Why givving a length to that array, as long as you build another number of elements?

Anyway, document.write is not a dynamic method. And it's deprecated.

What is in fact your final goal?

11-29-2005, 10:13 AM
this was a program to place some numbers on the screen - on specific positions, but these numbers and their position is changing (every second),and I used a function with a timer to place the numbers on their actual positions
this code is only a part from the source - without loops and other math formulas.

the question is

how can I use a function for outputting some things on specific positions( I used divs for that)

then recall that function for many times, to output another things, and the previos outputs to not dissapear


11-29-2005, 10:31 AM
you may use dynamic methods:

or DOM method

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum