pr_r
asked on
deleting row problem
hi
I am trying to create arow dynamically.
I could do it wothout eror.
Assume that i added 3 rows.now if i check the checkbox of second row and click delete ,it is successful .after that i tried the next row it is giving error.
Please help
<html>
<head>
<title>Effort Search</title>
<script language="JavaScript">
function setActivity()
{
var actval
//actval = document.esas.activity.val ue
//document.esrfs.hact.valu e = actval
//document.esrfs.hactbool. value = "1"
}
var check
check =0
var check1
check1 =0
function clickDelete()
{
var count;
count = document.esas.hidID.value;
for (var i = 1; i <= count; i++)
{
if (eval("document.esas.hidRo w"+i+".che cked") == false)
check = 1;
else
check1 = 2;
}
if (check1 != 2)
{
alert("select check box");
return false;
}
else
{
for (var i = 1; i <= count; i++)
{
if (eval("document.esas.hidRo w"+i+".che cked") == true)
{
tab1.deleteRow(i);
document.esas.hidID.value = document.esas.hidID.value - 1
}
}
alert(document.esas.hidID. value);
}
}
function clearcomboact(no)
{
var obj
obj=eval("document.esas.ac tivity"+no )
for (var i = obj.options.length-1;i>=0; i--)
{
obj.options[i] = null
}
obj.selectedIndex = -1;
}
function PhaseList()
{
for(var i=0;i<obj.length;i++)
{
document.esas.activity.opt ions[docum ent.esas.a ctivity.op tions.leng th] = new Option(obj[i][1],obj[i][0] );
}
}
function clickAdd()
{
document.esas.hidAdd.value = parseInt(document.esas.hid Add.value) + 1;
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
function clickSave()
{
document.esas.hidAct.value = "save"
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
var newID=1
function add1()
{
var act
var phase
phase=""
act1=""
objAdd = tab1.insertRow(tab1.rows.l ength);
objAdd.insertCell(0);
objAdd.insertCell(1);
objAdd.insertCell(2);
newinput1 = document.createElement("<S ELECT name = activity"+ newID+">");
//newinput1.name = "activity"+ newID+'';
newinput1.ID = "act"+ newID+'';
actName= "activity"+ newID+'';
objAdd.cells.item(1).appen dChild(new input1);
newinput0 = document.createElement("<S ELECT name = phase"+ newID+" onchange=phaseselect1(this ,newinput2 ,act1,actN ame)>");
//newinput0.name = "phase"+ newID+'';
newinput0.options[newinput 0.options. length] = new Option('All Phases','',true,true);
//newinput0.options[newinp ut0.option s.length] = new Option("HI","HI1",false,tr ue);
for(var i=0;i<phaseArray.length;i+ +)
{
if (phase==phaseArray[i][0])
{
newinput0.options[newinput 0.options. length] = new Option(phaseArray[i][1],ph aseArray[i ][0],false ,true);
}
else
{
newinput0.options[newinput 0.options. length] = new Option(phaseArray[i][1],ph aseArray[i ][0]);
}
}
objAdd.cells.item(0).appen dChild(new input0);
newinput2 = document.createElement("<i nput type=checkbox name = hidRow"+ newID+">");
newinput2.name = "hidRow"+ newID+'';
//newinput2.value = newID;
objAdd.cells.item(2).appen dChild(new input2);
//phaseselect1(newinput0,n ewID,act,n ewinput1)
newinput1.options[newinput 1.options. length] = new Option('All Activities','',true,true);
document.esas.hidID.value = newID
newID=newID+1
}
function phaseselect1(elem,no,act,o bjName)
{
//clearcomboact(no);
var objact
phaseName = elem.name
phaseName = phaseName.substring(5,phas eName.leng th)
str = "activity"+phaseName
for (var i = 0; i < document.esas.elements.len gth; i++)
{
if (document.esas.elements[i] .name==str )
{
objact = document.esas.elements[i]
}
}
for (var i = objact.options.length-1;i> =0;i--)
{
objact.options[i] = null
}
objact.options[objact.opti ons.length ] = new Option('All Activities','',true,true);
if (elem.options[elem.selecte dIndex].va lue!="" )
{
obj1 =eval("arr"+elem.options[e lem.select edIndex].v alue)
for(var i=0;i<obj1.length;i++)
{
if (act==obj1[i][0])
{
objact.options[objact.opti ons.length ] = new Option(obj1[i][1],obj1[i][ 0],false,t rue);
}
else
{
objact.options[objact.opti ons.length ] = new Option(obj1[i][1],obj1[i][ 0]);
}
}
}
}
</script>
</head>
<script language=javascript>var phaseArray=[['adm','Admini stration'] ];
var arradm=[['adm016','Arrangi ng Meetings'],['adm008','Atte ndance System']];
</script>
<body>
<form name="esas" action="pradeepaSub.asp" method=post>
<table border="1" width="100%" id=tab1>
<tr>
<td bgcolor = "#d6d6ab">
<label >Phase</label>
</td>
<td width="41%" bgcolor = "e8e8d2">
<label><label>Activity</la bel>
</td>
</tr>
</table>
<br>
<div align='center'>
<input type=button name=add onclick="add1()" value="Add">
<input type=button name=butDel onclick="clickDelete()" value="Delete">
<input type="submit" value="Save" name="addSave" >
<input type="hidden" name="hidID">
</div>
</form>
</body>
</html>
I am trying to create arow dynamically.
I could do it wothout eror.
Assume that i added 3 rows.now if i check the checkbox of second row and click delete ,it is successful .after that i tried the next row it is giving error.
Please help
<html>
<head>
<title>Effort Search</title>
<script language="JavaScript">
function setActivity()
{
var actval
//actval = document.esas.activity.val
//document.esrfs.hact.valu
//document.esrfs.hactbool.
}
var check
check =0
var check1
check1 =0
function clickDelete()
{
var count;
count = document.esas.hidID.value;
for (var i = 1; i <= count; i++)
{
if (eval("document.esas.hidRo
check = 1;
else
check1 = 2;
}
if (check1 != 2)
{
alert("select check box");
return false;
}
else
{
for (var i = 1; i <= count; i++)
{
if (eval("document.esas.hidRo
{
tab1.deleteRow(i);
document.esas.hidID.value = document.esas.hidID.value - 1
}
}
alert(document.esas.hidID.
}
}
function clearcomboact(no)
{
var obj
obj=eval("document.esas.ac
for (var i = obj.options.length-1;i>=0;
{
obj.options[i] = null
}
obj.selectedIndex = -1;
}
function PhaseList()
{
for(var i=0;i<obj.length;i++)
{
document.esas.activity.opt
}
}
function clickAdd()
{
document.esas.hidAdd.value
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
function clickSave()
{
document.esas.hidAct.value
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
var newID=1
function add1()
{
var act
var phase
phase=""
act1=""
objAdd = tab1.insertRow(tab1.rows.l
objAdd.insertCell(0);
objAdd.insertCell(1);
objAdd.insertCell(2);
newinput1 = document.createElement("<S
//newinput1.name = "activity"+ newID+'';
newinput1.ID = "act"+ newID+'';
actName= "activity"+ newID+'';
objAdd.cells.item(1).appen
newinput0 = document.createElement("<S
//newinput0.name = "phase"+ newID+'';
newinput0.options[newinput
//newinput0.options[newinp
for(var i=0;i<phaseArray.length;i+
{
if (phase==phaseArray[i][0])
{
newinput0.options[newinput
}
else
{
newinput0.options[newinput
}
}
objAdd.cells.item(0).appen
newinput2 = document.createElement("<i
newinput2.name = "hidRow"+ newID+'';
//newinput2.value = newID;
objAdd.cells.item(2).appen
//phaseselect1(newinput0,n
newinput1.options[newinput
document.esas.hidID.value = newID
newID=newID+1
}
function phaseselect1(elem,no,act,o
{
//clearcomboact(no);
var objact
phaseName = elem.name
phaseName = phaseName.substring(5,phas
str = "activity"+phaseName
for (var i = 0; i < document.esas.elements.len
{
if (document.esas.elements[i]
{
objact = document.esas.elements[i]
}
}
for (var i = objact.options.length-1;i>
{
objact.options[i] = null
}
objact.options[objact.opti
if (elem.options[elem.selecte
{
obj1 =eval("arr"+elem.options[e
for(var i=0;i<obj1.length;i++)
{
if (act==obj1[i][0])
{
objact.options[objact.opti
}
else
{
objact.options[objact.opti
}
}
}
}
</script>
</head>
<script language=javascript>var phaseArray=[['adm','Admini
var arradm=[['adm016','Arrangi
</script>
<body>
<form name="esas" action="pradeepaSub.asp" method=post>
<table border="1" width="100%" id=tab1>
<tr>
<td bgcolor = "#d6d6ab">
<label >Phase</label>
</td>
<td width="41%" bgcolor = "e8e8d2">
<label><label>Activity</la
</td>
</tr>
</table>
<br>
<div align='center'>
<input type=button name=add onclick="add1()" value="Add">
<input type=button name=butDel onclick="clickDelete()" value="Delete">
<input type="submit" value="Save" name="addSave" >
<input type="hidden" name="hidID">
</div>
</form>
</body>
</html>
ASKER
hi
Please move this to javascript section
Please move this to javascript section
pr_r , did you try my fix ?
<html>
<head>
<title>Effort Search</title>
<script language="JavaScript">
function setActivity()
{
var actval
//actval = document.esas.activity.val ue
//document.esrfs.hact.valu e = actval
//document.esrfs.hactbool. value = "1"
}
var check
check =0
var check1
check1 =0
function clickDelete()
{
var check1 = null;
var oTable = document.getElementById("t ab1");
var iCount = oTable.rows.length-1;
for (var i = 0; i < iCount; i++)
{
var oCheckBox = oTable.rows[i+1].cells[2]. firstChild ;
if (oCheckBox.checked)
{
check1 = i;
break;
}
}
if (check1 == null)
{
alert("select check box");
return false;
}
else
{
for (var i = 0; i < iCount; i++)
{
var oCheckBox = oTable.rows[i+1].cells[2]. firstChild ;
if (oCheckBox.checked)
{
tab1.deleteRow(i+1);
document.esas.hidID.value = parseInt(document.esas.hid ID.value)- 1;
iCount--;
i--;
}
}
}
}
function clearcomboact(no)
{
var obj
obj=eval("document.esas.ac tivity"+no )
for (var i = obj.options.length-1;i>=0; i--)
{
obj.options[i] = null
}
obj.selectedIndex = -1;
}
function PhaseList()
{
for(var i=0;i<obj.length;i++)
{
document.esas.activity.opt ions[docum ent.esas.a ctivity.op tions.leng th] = new Option(obj[i][1],obj[i][0] );
}
}
function clickAdd()
{
document.esas.hidAdd.value = parseInt(document.esas.hid Add.value) + 1;
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
function clickSave()
{
document.esas.hidAct.value = "save"
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
var newID=1
function add1()
{
var act
var phase
phase=""
act1=""
objAdd = tab1.insertRow(tab1.rows.l ength);
objAdd.insertCell(0);
objAdd.insertCell(1);
objAdd.insertCell(2);
newinput1 = document.createElement("<S ELECT name = activity"+ newID+">");
//newinput1.name = "activity"+ newID+'';
newinput1.ID = "act"+ newID+'';
actName= "activity"+ newID+'';
objAdd.cells.item(1).appen dChild(new input1);
newinput0 = document.createElement("<S ELECT name = phase"+ newID+" onchange=phaseselect1(this ,newinput2 ,act1,actN ame)>");
//newinput0.name = "phase"+ newID+'';
newinput0.options[newinput 0.options. length] = new Option('All Phases','',true,true);
//newinput0.options[newinp ut0.option s.length] = new Option("HI","HI1",false,tr ue);
for(var i=0;i<phaseArray.length;i+ +)
{
if (phase==phaseArray[i][0])
{
newinput0.options[newinput 0.options. length] = new Option(phaseArray[i][1],ph aseArray[i ][0],false ,true);
}
else
{
newinput0.options[newinput 0.options. length] = new Option(phaseArray[i][1],ph aseArray[i ][0]);
}
}
objAdd.cells.item(0).appen dChild(new input0);
newinput2 = document.createElement("<i nput type=checkbox name = hidRow"+ newID+">");
newinput2.name = "hidRow"+ newID+'';
//newinput2.value = newID;
objAdd.cells.item(2).appen dChild(new input2);
//phaseselect1(newinput0,n ewID,act,n ewinput1)
newinput1.options[newinput 1.options. length] = new Option('All Activities','',true,true);
document.esas.hidID.value = newID
newID=newID+1
}
function phaseselect1(elem,no,act,o bjName)
{
//clearcomboact(no);
var objact
phaseName = elem.name
phaseName = phaseName.substring(5,phas eName.leng th)
str = "activity"+phaseName
for (var i = 0; i < document.esas.elements.len gth; i++)
{
if (document.esas.elements[i] .name==str )
{
objact = document.esas.elements[i]
}
}
for (var i = objact.options.length-1;i> =0;i--)
{
objact.options[i] = null
}
objact.options[objact.opti ons.length ] = new Option('All Activities','',true,true);
if (elem.options[elem.selecte dIndex].va lue!="" )
{
obj1 =eval("arr"+elem.options[e lem.select edIndex].v alue)
for(var i=0;i<obj1.length;i++)
{
if (act==obj1[i][0])
{
objact.options[objact.opti ons.length ] = new Option(obj1[i][1],obj1[i][ 0],false,t rue);
}
else
{
objact.options[objact.opti ons.length ] = new Option(obj1[i][1],obj1[i][ 0]);
}
}
}
}
</script>
</head>
<script language=javascript>var phaseArray=[['adm','Admini stration'] ];
var arradm=[['adm016','Arrangi ng Meetings'],['adm008','Atte ndance System']];
</script>
<body>
<form name="esas" action="pradeepaSub.asp" method=post>
<table border="1" width="100%" id=tab1>
<tr>
<td bgcolor = "#d6d6ab">
<label >Phase</label>
</td>
<td width="41%" bgcolor = "e8e8d2">
<label><label>Activity</la bel>
</td>
</tr>
</table>
<br>
<div align='center'>
<input type=button name=add onclick="add1()" value="Add">
<input type=button name=butDel onclick="clickDelete()" value="Delete">
<input type="submit" value="Save" name="addSave" >
<input type="hidden" name="hidID">
</div>
</form>
</body>
</html>
<html>
<head>
<title>Effort Search</title>
<script language="JavaScript">
function setActivity()
{
var actval
//actval = document.esas.activity.val
//document.esrfs.hact.valu
//document.esrfs.hactbool.
}
var check
check =0
var check1
check1 =0
function clickDelete()
{
var check1 = null;
var oTable = document.getElementById("t
var iCount = oTable.rows.length-1;
for (var i = 0; i < iCount; i++)
{
var oCheckBox = oTable.rows[i+1].cells[2].
if (oCheckBox.checked)
{
check1 = i;
break;
}
}
if (check1 == null)
{
alert("select check box");
return false;
}
else
{
for (var i = 0; i < iCount; i++)
{
var oCheckBox = oTable.rows[i+1].cells[2].
if (oCheckBox.checked)
{
tab1.deleteRow(i+1);
document.esas.hidID.value = parseInt(document.esas.hid
iCount--;
i--;
}
}
}
}
function clearcomboact(no)
{
var obj
obj=eval("document.esas.ac
for (var i = obj.options.length-1;i>=0;
{
obj.options[i] = null
}
obj.selectedIndex = -1;
}
function PhaseList()
{
for(var i=0;i<obj.length;i++)
{
document.esas.activity.opt
}
}
function clickAdd()
{
document.esas.hidAdd.value
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
function clickSave()
{
document.esas.hidAct.value
document.esas.method = "post";
document.esas.action = "dynamic linked select box from database1.asp";
document.esas.submit();
}
var newID=1
function add1()
{
var act
var phase
phase=""
act1=""
objAdd = tab1.insertRow(tab1.rows.l
objAdd.insertCell(0);
objAdd.insertCell(1);
objAdd.insertCell(2);
newinput1 = document.createElement("<S
//newinput1.name = "activity"+ newID+'';
newinput1.ID = "act"+ newID+'';
actName= "activity"+ newID+'';
objAdd.cells.item(1).appen
newinput0 = document.createElement("<S
//newinput0.name = "phase"+ newID+'';
newinput0.options[newinput
//newinput0.options[newinp
for(var i=0;i<phaseArray.length;i+
{
if (phase==phaseArray[i][0])
{
newinput0.options[newinput
}
else
{
newinput0.options[newinput
}
}
objAdd.cells.item(0).appen
newinput2 = document.createElement("<i
newinput2.name = "hidRow"+ newID+'';
//newinput2.value = newID;
objAdd.cells.item(2).appen
//phaseselect1(newinput0,n
newinput1.options[newinput
document.esas.hidID.value = newID
newID=newID+1
}
function phaseselect1(elem,no,act,o
{
//clearcomboact(no);
var objact
phaseName = elem.name
phaseName = phaseName.substring(5,phas
str = "activity"+phaseName
for (var i = 0; i < document.esas.elements.len
{
if (document.esas.elements[i]
{
objact = document.esas.elements[i]
}
}
for (var i = objact.options.length-1;i>
{
objact.options[i] = null
}
objact.options[objact.opti
if (elem.options[elem.selecte
{
obj1 =eval("arr"+elem.options[e
for(var i=0;i<obj1.length;i++)
{
if (act==obj1[i][0])
{
objact.options[objact.opti
}
else
{
objact.options[objact.opti
}
}
}
}
</script>
</head>
<script language=javascript>var phaseArray=[['adm','Admini
var arradm=[['adm016','Arrangi
</script>
<body>
<form name="esas" action="pradeepaSub.asp" method=post>
<table border="1" width="100%" id=tab1>
<tr>
<td bgcolor = "#d6d6ab">
<label >Phase</label>
</td>
<td width="41%" bgcolor = "e8e8d2">
<label><label>Activity</la
</td>
</tr>
</table>
<br>
<div align='center'>
<input type=button name=add onclick="add1()" value="Add">
<input type=button name=butDel onclick="clickDelete()" value="Delete">
<input type="submit" value="Save" name="addSave" >
<input type="hidden" name="hidID">
</div>
</form>
</body>
</html>
ASKER
hi it is not working in ie5.0
it is giving doctor watson error
it is giving doctor watson error
ASKER
hi it is not working in ie5.0
it is giving doctor watson error
it is giving doctor watson error
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This question has been classified abandoned. I will make a recommendation to the
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
moderators on its resolution in a week or two. I appreciate any comments
that would help me to make a recommendation.
<note>
Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.
</note>
If the user does not know how to close the question, the options are here:
https://www.experts-exchange.com/help/closing.jsp
Cd&
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept avner's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Programming_Gal
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept avner's comment as answer
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Programming_Gal
EE Cleanup Volunteer
ASKER
Please move this to javascript section