Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Capturing array displayed in html and saving it to a text file

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
In VBscript im trying to grab the text inputed from an array that is displayed in HTML body add text to it and then save it back to the same array file i pulled the origional text form. All i can find out there on tutorials or at the bookstore is how to writelines writeblanklines, or write text that is imputed inside the code. However, I need the newfile.write "TEXTvariable?" below in the function to be something dynamic like a variable. Anyways im just trying to figure out how to capture and write the text at the moment. Here what ive been working on, i've been running this file as a .hta and creating that file on my c:

<html>

<SCRIPT LANGUAGE=&quot;VBScript&quot;>
<!-- hide from older browsers

function writeTest()
Dim filesys, newfile
Set filesys = CreateObject(&quot;Scripting.FileSystemObject&quot;)
Set newfile = filesys.CreateTextFile(&quot;text.tab&quot;, True)
newfile.write &quot;TEXT Variable?&quot;
newfile.Close
end function

// stop hiding -->
</SCRIPT>

<BODY ID=body1>
<OBJECT ID=elements CLASSID=&quot;clsid:333C7BC4-460F-11D0-BC04-0080C7055A83&quot;>
<PARAM NAME=&quot;DataURL&quot; VALUE=&quot;text.tab&quot;>
<PARAM NAME=&quot;UseHeader&quot; VALUE=&quot;True&quot;>
<PARAM NAME=&quot;FieldDelim&quot; VALUE=&quot;|&quot;>
<PARAM NAME=&quot;EscapeChar&quot; VALUE=&quot;*&quot;>
<PARAM NAME=&quot;TextQualifier&quot; VALUE=&quot;'&quot;>
<PARAM NAME=&quot;Sort&quot; VALUE=&quot;Filename&quot;>
</OBJECT>

<TABLE datasrc=#elements BORDER CELLPADDING=2 BGCOLOR=&quot;#BBB8DC&quot; STYLE=&quot;margin-left:5&quot;>
<THEAD>
<TR>
<TD><B>Question</B></TD>
<TD><B>Answer</B></TD>
</TR></THEAD>
<TBODY>
<TR>
<TD><DIV datafld=&quot;Question&quot;></DIV></TD>
<TD><DIV datafld=&quot;Answer&quot;></DIV></TD>
</TR></TBODY>
</TABLE>

<FORM NAME=&quot;testbutton&quot;>
<INPUT TYPE=&quot;button&quot; NAME=&quot;but2&quot; VALUE=&quot;Update&quot; onClick=&quot;writeTest()&quot;>
</FORM>
</body>

</html>


The text.tab file looks like this:

Question|Answer
How old are you?|28
Where are you?|Here i am

Ive tired making variables and doing something like this: document.all.body1.createTextRange() I can't seem to figure this out, if anyone can help id appreciate it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top