Hello List!
Newbie to javascript and have a few questions...
I want to number my FormElements to make them unique
So, I want the one named 'dupmerows_<tableid>' to be: 'dupmerows_<tableid>_<cnt>
So, I'll have a dupmerows_6_1, dupmerows_6_2
And, likewise with my other elements: counttype_<tableid>_<cnt> and countname_<tableid>_<cnt>
This is the mess I have so far
How can I get it to uniquely name them???
ie: dupmerows_1_1, dupmerows_1_2...counttype_6_1, counttypes_6_2...countname_6_2, countname_6_2, etc??
Thanks in advance for your time and help!!
Newbie to javascript and have a few questions...
I want to number my FormElements to make them unique
So, I want the one named 'dupmerows_<tableid>' to be: 'dupmerows_<tableid>_<cnt>
So, I'll have a dupmerows_6_1, dupmerows_6_2
And, likewise with my other elements: counttype_<tableid>_<cnt> and countname_<tableid>_<cnt>
This is the mess I have so far
Code:
<script language="JavaScript">
function dupIt(itm){
var dup = document.getElementById("dupme_" + itm);
var clone = dup.cloneNode(true);
var cloned = dup.appendChild(clone);
cloned.childNodes[1].firstChild.selectedIndex=0;
cloned.childNodes[2].firstChild.value=0;
cloned.childNodes[1].firstChild.name=cloned.childNodes[1].firstChild.name.substring(0,11)
cloned.childNodes[1].firstChild.name=cloned.childNodes[1].firstChild.name + "_" + cnt
}
:
:
cnt = 0
for i = 0 to UBound(aInfo, 2)
:
:
Response.Write "<tr id=""dupmerows_" & aInfo(7,i) & "_" & cnt &""">"
Response.Write "<th colspan=""5""></th>"
Response.Write "<td>"'countType
Response.Write "<select size=""1"" name=""CountType_" & aInfo(7,i) & "_" & cnt &""">"
Response.Write"<option value="""">Please Select...</option>"
For Each item In countType
Response.Write"<option value ="& item & """"
if item = aInfo(5,i) then
Response.Write " selected"
end if
Response.Write ">"& item &"</option>"
Next
Response.Write "</select>"
Response.Write "</td>"
Response.Write "<td>"'count
Response.Write "<input size=""10"" type=""text"" name=""countName_" & aInfo(7,i) & "_" & cnt &""" value=" & aInfo(6,i) & " onchange=""return numCheck(this)"">"
Response.Write "<input type=""button"" value=""Add"" onClick=""dupIt('" & aInfo(7,i) &"')"">"
:
:
How can I get it to uniquely name them???
ie: dupmerows_1_1, dupmerows_1_2...counttype_6_1, counttypes_6_2...countname_6_2, countname_6_2, etc??
Thanks in advance for your time and help!!