hi experts,
i'm developing a page in ASP but i'm doing also some javascript insode the page. i'm creating a frame and i want to loop this frame with a duplicateloop function so the form will be duplicate so many time, also i'm using a removeloop if the client want to remove the frame, in the html of the page i'm creating a table and i'm calling this loop, the problem now is that when i'm calling the removeloop it removes the frame but not the table in the html, so if i do the removeloop so many times the table will be big and big and big., how can i remove the table also when i'm calling the removeloop function.
second problem is that i'm calling an asp page inside the frame, i want to make the link to the css files dynamic but it seems that javascript does not alow that, in the asp page inside javascript function i'm calling also a function to get the same token of the page dynamically but it seems that it's not working.
here is the code for the remove loop and duplicate loop:
duplicateloop:
- function duplicateLoop(nbr, useData){
-
var u;
-
-
var ta = document.getElementById("loop"+nbr+"_0");
-
for (var i=0; i<ta.childNodes.length; i++ ) {
-
if (ta.childNodes[i].tagName == 'TBODY')
-
ta = ta.childNodes[i];
-
}
-
if (!useData) {
-
for (var i = 1; i <= nbrLoop[nbr]; i++) {
-
var f = getFrame('frame'+nbr+'_'+i);
-
}
-
}
-
nbrLoop[nbr]++;
-
var tr = document.createElement('TR');
-
var td = document.createElement('TD');
-
var i = document.createElement('IFRAME');
-
i.frameBorder=0;
-
//if (nbr==0) {
-
u = '/folder/folder2/page.asp?<%=asp function%>';
-
i.style.height = '480px';
-
//}
-
//u = u+nbrLoop[nbr]+'&getData='+useData;
-
i.src = u;
-
//alert(i.src);
-
i.id = 'frame'+nbr+'_'+nbrLoop[nbr];
-
i.style.width = '600px';
-
i.scrolling = 'no';
-
tr.id = 'tr'+nbrLoop[nbr];
-
td.appendChild(i);
-
tr.appendChild(td);
-
ta.appendChild(tr);
-
enumInputs(document.body);
-
}
-
remove loop:
- function removeLoop(nbr,row){
-
var f = document.getElementById('frame'+nbr+'_'+row);
-
f.parentNode.removeChild(f);
-
for (var i = row+1; i <= nbrLoop[nbr]; i++ ) {
-
//var f = top.frames['frame'+nbr+'_'+i];
-
var f = getFrame('frame'+nbr+'_'+i);
-
//f.reNumber(i-1);
-
f = document.getElementById('frame'+nbr+'_'+i);
-
f.id = 'frame'+nbr+'_'+(i-1);
-
}
-
nbrLoop[nbr]--;
the code in html:
[HTML]<a id='makeNew' style='display:' href="javascript
:window.parent.duplicateLoop(0);"> more + </a></td>
<span id="loop0span">
<table id="loop0_0" border="1"></table></span>
[/HTML]
any suggestions will be very appreciated.
i've been working in this now for 2 days.
thanks