Go Back   CodingForums.com > :: Computing & Sciences > Computer Programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-25-2002, 01:36 PM   PM User | #1
hughesmi
Regular Coder

 
Join Date: Jul 2002
Location: UK
Posts: 302
Thanks: 16
Thanked 0 Times in 0 Posts
hughesmi is an unknown quantity at this point
Display problems

Can somehelp me, the question is two parts!


Firstly - How can I get the Tiltle's of the fields to display as well as the data?
i.e

Tile. Artist.


Secondly- How can I get the data to display on a new page only.




<script language="vbscript">

' create the file system object
set fso = CreateObject("Scripting.FileSystemObject")

'load the file
set f = fso.GetFile("data/test.htm")

sub readfileback

Const ForReading = 1, ForWriting = 2, ForAppending = 8



set ts = f.OpenAsTextStream(ForReading, -2)

thestring = "<table bgcolor='white' cellspacing=1 cellpadding=3>"

Do While not ts.AtEndOfStream
textline = ts.ReadLine
myArray = Split(textline,",")
if UBound(myArray) > 0 Then
if myArray(0) <> "" Then
thestring = thestring & "<tr bgcolor='blue'>"
For i = 0 To UBound(myArray)
thestring = thestring & "<td>" & myArray(i) & "</td>"
Next
thestring = thestring & "</tr>"
end if
end if
Loop

thediv.innerHTML = thestring
ts.close
end sub





Sub createtextfile
Const ForReading = 1, ForWriting = 2, ForAppending = 8

Set a = f.OpenAsTextStream(ForAppending, -2)
a.WriteLine(theform.title.value & "," & theform.artist.value & "," & theform.album.value & "," & theform.number.value)
a.Close
theform.title.value=""
theform.artist.value=""
theform.album.value=""
theform.number.value=""
readfileback
end sub
</script>

<body onload="readfileback">
<form name="theform">

&nbsp;
<div align="center">
<center>
<table border="0" width="280" height="39">
<tr>
<td width="107" height="7" align="right">

<b><font color="#006699">

Title:&nbsp;</font></b></td>
<td width="3" height="7" align="left">

</td>
<td width="147" height="7" align="left"> <input type="text" name="title">
</td>
</tr>
<tr>
<td width="107" height="6" align="right">
<b><font color="#006699">
Artist :&nbsp;</font></b></td>
<td width="3" height="6" align="left">
</td>
<td width="147" height="6" align="left"> <input type="text" name="artist">
</td>
</tr>
<tr>
<td width="107" height="5" align="right">
<b><font color="#006699">
Album :&nbsp;</font></b></td>
<td width="3" height="5" align="left">
</td>
<td width="147" height="5" align="left"> <input type="text" name="album">
</td>
</tr>
<tr>
<td width="107" height="5" align="right">
<b><font color="#006699">
Number:</font></b> </td>
<td width="3" height="5" align="left">
</td>
<td width="147" height="5" align="left"> <input type="text" name="number">
</td>
</tr>
</table>
</center>
</div>
<p align="center">
<br>
<input type="button" value="a d d" name="thebutton" onclick="createtextfile">
</p>
</form>



<div id="thediv"></div>
</body>
__________________
Kind regards,
Mike Hughes
hughesmi is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:26 AM.


Advertisement
Log in to turn off these ads.