johnnyi
06-16-2006, 06:41 PM
Howdy,
I have two separate functions, both which work as intended but only if executed separately (i.e. from two separate buttons). Problem is, I can neither combine these into one function, nor execute with a onclick="formtypearray();testthis();" event.
function formtypearray()
{
document.getElementById('FunctionArray').value = '';
var incominglist;
incominglist = document.getElementById('PeopleArray').value;
var str = incominglist;
var a1 = new Array();
a1 = str.split("|");
for (i=0;a1.length-1;i++)
{
a1[i] = document.getElementById(a1[i]+'2').value;
document.getElementById('FunctionArray').value = document.getElementById('FunctionArray').value.concat('|',a1[i]);
}
}
function testthis()
{
var thestring;
thestring = document.getElementById('FunctionArray').value;
document.getElementById('FunctionArray').value = thestring.substr(1);
}
Can anyone enlighten me as to why I can't combine these into one function like this? (or run the two functions separately in one onclick event)?
function formtypearray()
{
document.getElementById('FunctionArray').value = '';
var incominglist;
incominglist = document.getElementById('PeopleArray').value;
var str = incominglist;
var a1 = new Array();
a1 = str.split("|");
for (i=0;a1.length-1;i++)
{
a1[i] = document.getElementById(a1[i]+'2').value;
document.getElementById('FunctionArray').value = document.getElementById('FunctionArray').value.concat('|',a1[i]);
}
var thestring;
thestring = document.getElementById('FunctionArray').value;
document.getElementById('FunctionArray').value = thestring.substr(1);
}
Thanks,
- I
PS - Let me know if you need any more detail - such as the HTML code.
I have two separate functions, both which work as intended but only if executed separately (i.e. from two separate buttons). Problem is, I can neither combine these into one function, nor execute with a onclick="formtypearray();testthis();" event.
function formtypearray()
{
document.getElementById('FunctionArray').value = '';
var incominglist;
incominglist = document.getElementById('PeopleArray').value;
var str = incominglist;
var a1 = new Array();
a1 = str.split("|");
for (i=0;a1.length-1;i++)
{
a1[i] = document.getElementById(a1[i]+'2').value;
document.getElementById('FunctionArray').value = document.getElementById('FunctionArray').value.concat('|',a1[i]);
}
}
function testthis()
{
var thestring;
thestring = document.getElementById('FunctionArray').value;
document.getElementById('FunctionArray').value = thestring.substr(1);
}
Can anyone enlighten me as to why I can't combine these into one function like this? (or run the two functions separately in one onclick event)?
function formtypearray()
{
document.getElementById('FunctionArray').value = '';
var incominglist;
incominglist = document.getElementById('PeopleArray').value;
var str = incominglist;
var a1 = new Array();
a1 = str.split("|");
for (i=0;a1.length-1;i++)
{
a1[i] = document.getElementById(a1[i]+'2').value;
document.getElementById('FunctionArray').value = document.getElementById('FunctionArray').value.concat('|',a1[i]);
}
var thestring;
thestring = document.getElementById('FunctionArray').value;
document.getElementById('FunctionArray').value = thestring.substr(1);
}
Thanks,
- I
PS - Let me know if you need any more detail - such as the HTML code.