<%
book_file = "DRead/book.dat";
fs = Server.CreateObject ("GlobeScripting.FileSystemObject");
function LoadBook (name)
{
book = new Array();
if (CheckBook (name)) {
file = fs.OpenTextFile (Server.MapPath (name), 1);
var i = 0;
while (file.AtEndOfStream == false) {
book[i] = file.ReadLine();
i++;
}
file.Close();
}
return book;
}
function CheckBook (name)
{
return fs.FileExists (Server.MapPath (name));
}
function Odkaz (book)
{
if (book.length > 0) {
// Zde by stacilo zadat HTML kod.
Response.Write (" Zobrazit příspevky:
");
var pages = Math.ceil (book.length / 20);
for (i = 1; i <= pages; i++)
// Formatovani odkazu na jednotlive stranky s prispevky
Response.Write ("" + (i * 20 - 19)
+ "-" + (i * 20) + "  ");
Response.Write ("");
}
}
book = LoadBook (book_file);
%>
<%
if (CheckBook (book_file)) {
idprispevek_str = Request.QueryString ("idprispevek");
if (idprispevek_str == "")
idprispevek = 1;
else {
idprispevek = parseInt (idprispevek_str);
if (isNaN (idprispevek))
idprispevek = 1;
}
start = idprispevek * 20 - 20;
end = idprispevek * 20 - 1;
for (i = start; i <= end; i++) // Vypsani prispevku na aktualni strance.
Response.Write (book[i]);
}
Odkaz (book); // Zobrazeni odkazu na jednotlive stranky.
%>
|
|
| V textu zprávy jsou povoleny tagy <b>, <u>, <i> a <br>. Můžete psát i odkazy ve tvaru www.neco.cz nebo http://neco.neco.cz |
|