Maybe I just have not figured out an easier way to do this but in VB, but I have made an object for Javascript to search through. This object contains hidden fields for use in changing prices. The prices are a sum of different parts in a database. The kit has to come before the parts so using vb to add it up and place it in the correct spot is out, to my current knowledge. The entire page is built in code behind. I need javascript to search the object and get the value so I can tell it to put it somewhere else. Unless there is an easier way to do this. There are many hidden fields in the object. How would I get the value of the hidden field from the object without knowing it's id or value?
VB:
Dim kitprices As New StringBuilder
kitprices.Append("<input type='hidden' id='" & sdrgetpartlist.Item("partnumber").ToString & "' value='" & add & "'")
Dim kitobj as Object = kitprices.ToString
ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "Script", "getFind(" & kitobj & ");", True)
Javascript
function getFind(kitobj) {
for (i = 0; i < kitobj.childNodes.length; i++) {
if (kitobj.childNodes[i].tagName == "INPUT") {
if (kitobj.childNodes[i].type == "hidden") {
//var pt = document.getElementById("txt" + kitobj);
var k = kitobj.childNodes[i].id;
var v = kitobj.childNodes[i].getElementById("id").value;
}
}
}
This is what I have so far. I know it's a disaster.
Aucun commentaire:
Enregistrer un commentaire