</object>
yourdatafile.txt内容
name|age~premshree pillai~|~19~
下面介绍一下实际的应用及其优点:
假如我想在一个web页中显示一个表格用以存储我的通讯录,但是我又不想每一次再增加新内容或修改以前内容的时候都去修改我的web页,而且这样少的内容也并没有必要动用数据库那样的庞然大物,所以tdc方法就成了我的当然之选。
记住最好把你的*.txt文件和你的web页(*.htm)文件放在同一个目录下,首先我们先建立一个txl.txt文件(依照上面的格式),如下:
name|age|phone|qq|mail
~赵冠楠~|~22~|~1381303698~|~231312~|zhaogn@sina.com
~杨旭~|~22~|~1393023698~|~12256312~|yangx@sina.com
~韩红雷~|~23~|~138136556~|~8297312~|hanghl@sina.com
在这里我只记录了几条信息,为了见解就不再多写了。
然后开始建立我们的web页(tdc_ex.htm)如下:
<object id="txl" classid="clsid:333c7bc4-460f-11d0-bc04-0080c7055a83">
<param name="dataurl" value="txl.txt">
<param name="useheader" value="true">
<param name="textqualifier" value="~">
<param name="fielddelim" value="|">
</object>
<table datasrc="#txl" border="2"> //datasrc就是之所要读取数据的数据源,同开始声明的一样
<thead>
<th>姓名 :</th>
<th>年龄 :</th>
<th>电话 :</th>
<th>qq :</th>
<th>电子邮件 :</th>
</thead>
<tr>