📄 rollnews.jsp
字号:
<%@ 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();
}
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -