javascript 调用文本

来源:百度知道 编辑:UC知道 时间:2024/05/15 18:18:05
文本文件如下:
1.txt
图片地址1
图片地址2
图片地址3
.
.
.
.
图片地址n

要求用javascript设计个网页达到如下目的!
1:打开网页时显示第一张图片。
2:有“上一副图”“下一副图”按钮,能够翻页换图!!
(注:文本文件也可改为xml文件)
求教编程高手,不胜感激!!!

javascript 调用文本 需要调用fso,因为权限问题,实现起来有点困难,javascript 调用XML就方便多了,有疑问请Q我: 313736627

呵呵,这个应该可以的,你看看先
不过我只在IE上试过

文本文件这样写:
00.txt
::this is the 1st line:;
::this is the 2nd line:;
::this is the 3rd line:;
::this is the 4st line:;
::this is the 5st line:;
::this is the 6st line:;
::this is the 7st line:;
::this is the 8st line:;
::this is the 9st line:;
::this is the 10st line:;
::this is the 11st line:;
::this is the 12st line:;
::this is the 13st line:;

html里面这样调用(与00.txt放在同一个文件夹里):
<input type="button" onclick="get_line()" value="getline" />
<script type="text/javascript">
var s;
var endl,beginl;
var strend;
var templ=new Array();
var n=0;
function onDone(txtData) {
s=txtData;
gettempl();
}
function getdata(url) {
document.body.addBehavior("#default#d