P
phish.guy
How do I call another event's onclick function from a button press? I
have stored information dynamically created in a div onclick function
that is not accessible directly by the button, but i need to call the
onclick for the specific div.
my code looks like this:
<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
}
thanks in advance for any help...
have stored information dynamically created in a div onclick function
that is not accessible directly by the button, but i need to call the
onclick for the specific div.
my code looks like this:
<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
}
thanks in advance for any help...