javascript - Getting Input inside tag within a tbody? -


Just a quick question I know that this is a very long time and I have searched the entire stack overflow A work JavaScript function has been created to get tag values ​​within each row.

However, when I have a & lt; Tbody & gt; tag (required for line sorting), the JavaScript code will not work and I do not know why?

Please see the code given below:

  write the function XML () {var table = document.getElementById ('table_assoc'); Warning (table); Var rCount = document.getElementById ('tbody_id'). Rows.length; Warning (rCount); var fso = New ActiveXObject ("Scripting.FileSystemObject"); var FILENAME = "c: /XML.xml"; Var file = fso.CreateTextFile (FILENAME is true); file.WriteLine ('& lt;? xml version = "1.0" encoding = "UTF-8"? & gt; \ n'); file.WriteLine ('& lt; Seating_Plan & gt; \ N'); {Var id = table.rows [i] for (Var i = 1; i & lt; rCount; i ++) Seals [0]. Children [0] value; & Lt; - Contents reference context when & lt; Tbody & gt; The tag includes var deptcode = table.rows [i]. Seals [1]. Children [0] value; Var name = table.rows [i] Seals [2]. Children [0] .value; Var role = table.rows [i]. Cells [3]. Children [0] .value; Var desc = table.rows [i]. Seals [4]. Children [0] value; Var image = table.rows [i]. Seals [5]. Children [0] .value; Var asdir = table.rows [i]. Seals [6]. Children [0] value; File.WriteLine ('& lt; person id = "' + id + '" & gt; & lt; department & gt;' + deptcode + '& lt; / Dept & gt; & lt; name & gt;' + Name + '& lt; / name & gt; & lt; description & gt;; & lt; image & gt; & lt; image href = "' + + +" ">> gt; & lt; / image & gt; ;  & lt; role & gt; '+ role +' & lt; / role & gt; associatedir & gt; scaterror href = "'+ + ADIR +" / " gt; & lt; / Associate DIR & gt; & lt; / person & gt; '); } file.WriteLine ('& lt; / Seating_Plan & gt;'); File.Close (); }   

How do I work when adding the tbody tag?

=========================================== ===============================

Update:

HTML:

  & lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; & Lt; / Title & gt; & Lt; Script type = "text / javascript" src = "admin_javascript.js" & gt; & Lt; / Script & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div id = "header_logo" & gt; & Lt; / Div & gt; & Lt; Div id = "header_logo2" & gt; BMW UK & lt; / Div & gt; & Lt; Div id = "Admin_Header" & gt; BMW Layout Editor & lt; / Div & gt; & Lt; Div id = "Admin_nav" & gt; & Lt; an id = "btn_xml" class = "admin_new_button" & gt; XML & lt; / A & gt; & Lt; One class = "admin_new_button" & gt; Layout & lt; / A & gt; & Lt; / Div & gt; & Lt; Div id = "Admin_XML" & gt; & Lt; Div id = "XML_Buttons2" & gt; Load & lt; / Div & gt; & Lt; div id = "XML_Buttons" onClick = "writeXML ()" & gt; Save & lt; / Div & gt; & Lt; Period & gt; & Amp; Nbsp; & Lt; / Span & gt; & Lt; P class = "Admin_headers" & gt; Departments & lt; / P & gt; & Lt; Div id = "Admin_Dept_Container" & gt; & Lt; / Div & gt; & Lt; P class = "Admin_headers" & gt; Associates & lt; / P & gt; & Lt; div id = "Admin_Associate_Container" & gt; & Lt; Table id = "table_assoc" & gt; & Lt; Tbody id = "tbody_id" & gt; & Lt; Tr & gt; & Lt; Td> & Lt; Input value = "id" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; Input value = "deptcode" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; Input value = "name" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; Tr & gt; & Lt; Td> & Lt; Input value = "role" & gt; & Lt; / Td> & Lt; / Tr & gt; & Lt; / Tbody & gt; & Lt; / Table & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt; There is also a collection of    

tBodies , you can Get one from its index:

  var id = table.tbodies [0] .rows [i]. Seals [0]. Children [0] .value;    

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -