var theForm = document.getElementById("theForm"+1);
可以实现用变量表示(红字部分)theForm.title.value,但是没法表示(红字部分)theForm.title.value
最终希望实现的是:
调用jsjc(1)时,函数运行为:
function jsjc(1){
if (theForm1.title1.value.length<1)
{
alert("请填写标题!");
theForm1.title1.focus();
return false;
}
if (theForm1.content1.value=="")
{
alert("必须填写内容");
theForm1.content1.focus();
return false;
}
alert('添加成功,正在审核中...');history.go(-1);
} *************************************************************************************************************************************************************************************
调用函数jsjc(2)时,函数运行为:
function jsjc(2){
if (theForm2.title2.value.length<1)
{
alert("请填写标题!");
theForm2.title2.focus();
return false;
}
if (theForm2.content2.value=="")
{
alert("必须填写内容");
theForm2.content2.focus();
return false;
}
alert('添加成功,正在审核中...');history.go(-1);
}
可以实现用变量表示(红字部分)theForm.title.value,但是没法表示(红字部分)theForm.title.value
最终希望实现的是:
调用jsjc(1)时,函数运行为:
function jsjc(1){
if (theForm1.title1.value.length<1)
{
alert("请填写标题!");
theForm1.title1.focus();
return false;
}
if (theForm1.content1.value=="")
{
alert("必须填写内容");
theForm1.content1.focus();
return false;
}
alert('添加成功,正在审核中...');history.go(-1);
} *************************************************************************************************************************************************************************************
调用函数jsjc(2)时,函数运行为:
function jsjc(2){
if (theForm2.title2.value.length<1)
{
alert("请填写标题!");
theForm2.title2.focus();
return false;
}
if (theForm2.content2.value=="")
{
alert("必须填写内容");
theForm2.content2.focus();
return false;
}
alert('添加成功,正在审核中...');history.go(-1);
}
theForm.elements['title' + 2].value
theForm.['title' + 1].value
theForm.['title' + 2].value