How do I select a specific dynamic form element in JavaScript
In particular an <img>, which I don't think is considered an element, as if I do:
var el = document.frmSuppMessage.elements;
for(var i = 0 ; i < el.length ; ++i) {
alert("El name ="+ el[i].name +".");
}
<img ...> tags do not show up?
so I can't go through all elements and do a compare as I've done in the past :/
Main point:
The tag in question:
<img SRC="../images/+.gif" name="img<%=rsOrd.Fields("Part_No")%>" onclick="this.src=hideRows('<%=rsOrd.Fields("Part_No")%>')">
if I specify the exact name:
alert("this="+ document.imgECL250.src + ".");
gets me:
this=http://SERVER/SITE/images/+.gif
What I want to do is something like:
function hideRows(rowIDs)
{
var imgToMod;
imgToMod = "Buy" + rowIDs
alert("this="+ document.imgToMod.src + ".");
}
which of course gets me:
Error:'document.imgToMod.src' is null or not an object
But I think you get what I'm trying to do...
I can think of some sloppy hidden text input ways round this problem, but would love to know the smart way.
Cheers, Pailin