Link to home
Start Free TrialLog in
Avatar of gamblsj
gamblsj

asked on

HTML:Binding Data to a named file

I have the hdlist.txt indicated to create a table on this page, but only the headers display:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Bits and PCs Specials" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bits and PCs Specials</title>
</head>
<body>
<h1>Bits and PCs</h1>
<p>[<a href="index.htm" title="Bits and PCs home page">Home</a>]
[<a href="history/index.htm" title="Within these pages you'll find a history of personal computing as well as Bits and PC's own history">History Information</a>]
[<a href="specials.htm" title="Check out our advertised specials!">Advertised Specials</a>]
[<a href="products/index.htm" title="Find great deals on computers, monitors, accessories and more">Products</a>]
[<a href="services.htm" title="Let Bits and PC's take care of all your service needs.">Services</a>]</p>
<h3> Hard Drive Specials </h3>
<object id="hd" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param name="DataURL" value="hdlist.txt">
      <param name="UseHeader" value="True">
</object>
<script type="text/javascript" language="JavaScript">
function priceClick() {
      hd.Sort="price";
      hd.Reset();
}

price.onclick=priceClick;

function capacityClick() {
      hd.Sort="capacity";
      hd.Reset();
}

capacity.onclick=capacityClick;

//-->
</script>

<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="hdlist.txt" bordercolorlight="996633" bordercolordark="#006600" align="center">
<thead>
<tr>
<td><strong><div id="cap">Capacity(GB)</div></strong></td>
<td><strong><div id="buffer">BufferSize(M)</div></strong></td>
<td><strong><div id="rp">RPM</div></strong></td>
<td><strong><div id="pri">Price</div></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><div datafld="cap"></div></td>
<td><div datafld="buffer"></div></td>
<td><div datafld="rp"></div></td>
<td><div datafld="pric"></div></td>
<tr>
</tbody>
</body>
<div>For information about sales, service or store hours contact <a href="mailto:SG@bPCs.com">SG@bPCs.com</a></div>



</body>
</html> 

Open in new window

Avatar of aikimark
aikimark
Flag of United States of America image

I think you need to change the datasrc value to refer to your object as shown below.

I'm a bit concerned that both the object and the table have identical ID values
<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">

Open in new window

Avatar of gamblsj
gamblsj

ASKER

Here is the output:

Bits and PCs

[Home] [History Information] [Advertised Specials] [Products] [Services]

Hard Drive Specials

For information about sales, service or store hours contact SG@bPC.com

Capacity(GB) BufferSize(M) RPM Price
      

The bottom line should be a table that is populated by the file hdlist.txt, and the line that begins "For information...should be on the bottom.
      
      
@gamblsj

Did you change your HTML per my earlier comment?

What is the format of the text file?
Avatar of gamblsj

ASKER

Yes I changed the HTML, and the file is a .txt file.
Is it a delimited file?  If so, what is the delimiter?
Avatar of gamblsj

ASKER

Excuse my ignorance, but what is a delimited file?
A "delimited file" is a data format where the data values (and, optionally headers) are separated by one or more characters.  Most common delimiters are comma and tab.  You will frequently see the CSV file type used for comma-separated-variable (delimited) files.
Avatar of gamblsj

ASKER

Sorry, the delimiter is a comma.
Does it work if you rename the file hdlist.csv ?
I suspect you will need to add the following <param> tag to your object in order to process a comma-delimited file with a txt file type.
<PARAM NAME="FieldDelim" VALUE=",">

Open in new window

Avatar of gamblsj

ASKER

Still not working...
please post your HTML and upload the hdlist.txt file (after removing/obscuring contact information).
Avatar of gamblsj

ASKER

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="description" content="Bits and PCs Specials" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Bits and PCs Specials</title>
</head>
<body>
<h1>Bits and PCs</h1>
<p>[<a href="index.htm" title="Bits and PCs home page">Home</a>]
[<a href="history/index.htm" title="Within these pages you'll find a history of personal computing as well as Bits and PC's own history">History Information</a>]
[<a href="specials.htm" title="Check out our advertised specials!">Advertised Specials</a>]
[<a href="products/index.htm" title="Find great deals on computers, monitors, accessories and more">Products</a>]
[<a href="services.htm" title="Let Bits and PC's take care of all your service needs.">Services</a>]</p>
<h3> Hard Drive Specials </h3>
<object id="hd" classid="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83">
      <param name="DataURL" value="hdlist.txt">
      <param name="UseHeader" value="True">
	  <param name="FieldDelim" VALUE=",">
</object>
<script type="text/javascript" language="JavaScript">
function priceClick() {
      hd.Sort="price";
      hd.Reset();
}

price.onclick=priceClick;

function capacityClick() {
      hd.Sort="capacity";
      hd.Reset();
}

capacity.onclick=capacityClick;

//-->
</script>

<table width="90%" border="4" cellpadding="2" cellspacing="5" id="hd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">
<thead>
<tr>
<td><strong><div id="cap">Capacity(GB)</div></strong></td>
<td><strong><div id="buffer">BufferSize(M)</div></strong></td>
<td><strong><div id="rp">RPM</div></strong></td>
<td><strong><div id="pri">Price</div></strong></td>
</tr>
</thead>
<tbody>
<tr>
<td><div datafld="cap"></div></td>
<td><div datafld="buffer"></div></td>
<td><div datafld="rp"></div></td>
<td><div datafld="pric"></div></td>
<tr>
</tbody>
</body>
<div>For information about sales, service or store hours contact <a href="mailto@bPC.com">@bPC.com</a></div>



</body>
</html>

Open in new window

change the ID for the table tag so that you aren't getting a conflict.

What about the text file?
<table width="90%" border="4" cellpadding="2" cellspacing="5" id="tblhd" datasrc="#hd" bordercolorlight="996633" bordercolordark="#006600" align="center">

Open in new window

Avatar of gamblsj

ASKER

Here is the text of the file:

capacity,size(M),rpm,price
160,8,7200,$110.99
250,8,7200,$130.99
300,16,7200,$145.99
100,8,7200,$100.99
450,16,7200,$150.00
255,8,7200,$120.99
did you change the table ID and reload the page?
Avatar of gamblsj

ASKER

Yes
ASKER CERTIFIED SOLUTION
Avatar of aikimark
aikimark
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
@gamblsj

Did this answer your question?
@gamblsj

Are you ok?  Please post a comment.
Avatar of gamblsj

ASKER

Thanks for the assistance. I am working on the next phase and may need some help. Talk to you soon!
@gamblsj

When you are ready, click on the Ask A Related Question link.