intermanch
چهارشنبه 23 تیر 1389, 00:18 صبح
من با کد زیر تعدادی تکست که شماره هاشون پشت سر هم هست رو به درون یک div بصورت چیلد اون قرار دادم
m=1;
function Helloo($f)
{
for(i=s;i>e;i--)
{
//creat input
var myinput= document.createElement('input');
//how value input aqual on top
ml=document.getElementById('t'+i);
nm=ml.value;
//set input top value and input buttom value
myinput.setAttribute('value',nm);
//set name withod repeat
namy="j"+m;
myinput.setAttribute('name',namy);
myinput.setAttribute('title',m);
//set size
myinput.setAttribute('size',6);
//appand to div
document.getElementById("dl").appendChild(myinput);
m++;
}
حالا می خوام اگر با یه حلقه فور یکسری پشت سر هم و اگه اون چیلد موجود هستش حذف کنم :
for(3 to 10)
{
if (div.child is not undefined)
{
div.removechild(child.name or id //not first chlid and other...)
}
}
}
این کد آجاکس هم تصحیح کنید یا یه مثال ساده متقابلا ارائه دهید:
http://www.barnamenevis.org/forum/showthread.php?p=1028726
m=1;
function Helloo($f)
{
for(i=s;i>e;i--)
{
//creat input
var myinput= document.createElement('input');
//how value input aqual on top
ml=document.getElementById('t'+i);
nm=ml.value;
//set input top value and input buttom value
myinput.setAttribute('value',nm);
//set name withod repeat
namy="j"+m;
myinput.setAttribute('name',namy);
myinput.setAttribute('title',m);
//set size
myinput.setAttribute('size',6);
//appand to div
document.getElementById("dl").appendChild(myinput);
m++;
}
حالا می خوام اگر با یه حلقه فور یکسری پشت سر هم و اگه اون چیلد موجود هستش حذف کنم :
for(3 to 10)
{
if (div.child is not undefined)
{
div.removechild(child.name or id //not first chlid and other...)
}
}
}
این کد آجاکس هم تصحیح کنید یا یه مثال ساده متقابلا ارائه دهید:
http://www.barnamenevis.org/forum/showthread.php?p=1028726