wrote:
> <div id='field_1' onclick='divclick(this, *(field1 specific data*))'
> ...> ...</div>
> <div id='field_2' onclick='divclick(this, *(field1 specific data*))'
> ...> ...</div>
>
> <input id="doclick" type="button" value="value" onclick='nextMove()'/>
>
> now, either field 1 or 2 is 'active' so i keep that stored in
> javascript as
>
> var current; //lets say it is pointing to 'field_1'
>
> function nextMove()
> {
> var next= new Array();
> next= current.id.split('_');
> var num = next[1] * 1 ; //get string to int
> num++; //provides me with 2
> document.getElementById('field_' + num).click(); //DO CLICK on
> field_2 does not work
>
> }
You must already have a function called divclick defined somewhere,
thus all you need to do is call your function in your nextMove
function. For example, if I were to go along with your divclick
parameters, I would use them in the following manner:
function nextMove()
{
var oCurrentField = document.getElementById("field_" + num);
//grab your field specific data
var fielddata = ...
divclick(oCurrentField, fielddata);
...
}