rollnews.jsp
上传用户:xjrzjk
上传日期:2022-07-31
资源大小:1585k
文件大小:1k
- <%@ page contentType="text/html; charset=GBK" %>
- <%@ page import="java.io.*"%>
- <%
- try{
- //取得当前目录路径
- String strPath = request.getRealPath("");
- //建立FileReader对象
- FileReader fr = new FileReader(strPath + "\scroll.txt");
- //建立BufferedReader对象
- BufferedReader br = new BufferedReader(fr);
- //从文件读取一行字符串
- String Line = br.readLine();
- //判断读取到的字符串是否不为空
- String strNews = "";
- while(Line != null){
- strNews += Line + "<br>";
- Line = br.readLine();
- }
- br.close();
- fr.close();
- %>
- <html>
- <head>
- <title>
- 读取滚动新闻
- </title>
- </head>
- <body bgcolor="#ffffff">
- <marquee style="color:#000000;font-size:12px;line-height:20px;" direction="up" height="70" scrollamount="1" scrolldelay="100" onMouseOver="this.scrollDelay=500" onMouseOut="this.scrollDelay=1">
- <%=strNews%>
- </marquee>
- </body>
- </html>
- <%
- }catch(Exception e){
- e.printStackTrace();
- }
- %>