51.向文件中写内容 <%@ page import="java.io.*" %> <% String str = "print me"; //always give the path from root. This way it almost always works. String nameOfTextFile = "/usr/anil/imp.txt"; try { PrintWriter pw = new PrintWriter(new FileOutputStream(nameOfTextFile)); pw.println(str); //clean up pw.close(); } catch(IOException e) { out.println(e.getMessage()); } %> 52.先读文件再写文件 <%@ page language = "java" %> <%@ page contentType = "text/html; charSet=gb2312" %> <%@ page import ="java.util.*" %> <%@ page import ="java.lang.*" %> <%@ page import ="javax.servlet.*" %> <%@ page import ="javax.servlet.jsp.*" %> <%@ page import ="javax.servlet.http.*" %> <%@ page import="java.io.*" %> eryrytry <% int count=0; FileInputStream fi =new FileInputStream ("count.txt"); ObjectInputStream si= new ObjectInputStream (fi); count =si.readInt(); count++; out.print(count); si.close(); FileOutputStream fo =new FileOutputStream ("count.txt"); ObjectOutputStream so= new ObjectOutputStream (fo); so.writeInt(count); so.close(); %> 53.直线型输入框 <INPUT name=Password size=10 type=password style="border-left-width: 0; border-right-width: 0; border-top-width: 0; border-bottom-style: solid; border-bottom-width: 1; background-color: #9CEB9C"> 54.可以将背景改为按钮性状,通过改变css改变属性 <td width="65" align="center" bgcolor="#E0E0E0" onmouseover=this.className='mouseoverbt'; onmouseout=this.className='mouseout';><a href="tm.asp?classid=76"><font color="#000000">录音笔</font></a></td> <style> .mouseoverbt { background-image: url(<HTML> <style> #hint{ width:198px; border:1px solid #000000; background:#99ff33; position:absolute; z-index:9; padding:6px; line-height:17px; text-align:left; top: 1520px; } </style> <SCRIPT LANGUAGE="JavaScript"> <!-- function showme() { var oSon=window.document.getElementById("hint"); if (oSon==null) return; with (oSon) { innerText=guoguo.value; style.display="block"; style.pixelLeft=window.event.clientX+window.document.body.scrollLeft+6; style.pixelTop=window.event.clientY+window.document.body.scrollTop+9; } } function hidme() { var oSon=window.document.getElementById("hint"); if (oSon==null) return; oSon.style.display="none"; } //--> </SCRIPT> <BODY> <text id=guoguo value=ga> <a href=# onmouseover=showme() onmouseout=hidme() onmousemove=showme() son=hint>dfdfd</a> <div id=hint style="display:none"></div> </BODY> </HTML> --------------------------------------------------------------------------------------------------------- |