JavaScript Ū¨ú TXT ¤å¦rÀÉ
- ©«¤l
- 22
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 51
- ÂI¦W
- 0
- §@·~¨t²Î
- wiindows
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ·s¥_
- µù¥U®É¶¡
- 2021-6-21
- ³Ì«áµn¿ý
- 2022-1-4
|
JavaScript Ū¨ú TXT ¤å¦rÀÉ
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=charset=utf-8>" />
<title></title>
<script>
function readTextFile(file)
{
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function ()
{
if(rawFile.readyState === 4)
{
if(rawFile.status === 200 || rawFile.status == 0)
{
var allText = rawFile.responseText;
document.write(allText);
// alert(allText);
}
}
}
rawFile.send(null);
}
</script>
</head>
<body>
<script language="JavaScript">
readTextFile("./testfile.txt"); // testfile
</script>
</body>
</html> |
|
µ{¦¡¤Hû
|
|
|
|
|
- ©«¤l
- 22
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 51
- ÂI¦W
- 0
- §@·~¨t²Î
- wiindows
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ·s¥_
- µù¥U®É¶¡
- 2021-6-21
- ³Ì«áµn¿ý
- 2022-1-4
|
§ó¥¿
// alert(allText); -> Y¨Ï¥ÎªÌ§Æ±æìºô¶¯à«O¯dÅã¥Ü¡Ä¡A |
|
µ{¦¡¤Hû
|
|
|
|
|
- ©«¤l
- 22
- ¥DÃD
- 17
- ºëµØ
- 0
- ¿n¤À
- 51
- ÂI¦W
- 0
- §@·~¨t²Î
- wiindows
- ³nÅ骩¥»
- Office 2010
- ¾\ŪÅv
- 20
- ©Ê§O
- ¨k
- ¨Ó¦Û
- ·s¥_
- µù¥U®É¶¡
- 2021-6-21
- ³Ì«áµn¿ý
- 2022-1-4
|
¸É¥R
document.write(allText);
// alert(allText); -> Y¨Ï¥ÎªÌ¤£§Æ±æìºô¶¯à«O¯d¡A
¨º§A¥i¥H¥Î alert ³oÓ¨ç¼Æ¡A·|¸õ¥X·sªººô¶¥X¨Ó¡C |
|
µ{¦¡¤Hû
|
|
|
|
|