1.
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 4 <html> 5 <head> 6 <title>标题页</title> 7 </head> 8 <script language="JavaScript"> 9 function clear(){ 10 if (form1) { 11 clear = confirm("确定要关闭吗?",''); //关闭窗口的提示 12 if(clear) { //清空桌面的内容 13 document.form1.reset(); 14 document.form1.value = ""; 15 } 16 } 17 } 18 function test(){ 19 { 20 temp = document.form1.mytxt.value; //获取代码内容 21 testwin= open("", "testwin","status=no,menubar=yes,toolbar=no");//打开窗口 22 testwin.document.open(); 23 testwin.document.write(temp); //在窗口内输入内容 24 testwin.document.close(); //关闭窗口 25 } 26 } 27 function about(){ //“关于”按钮的提示 28 alert("可以直接在页面中显示输入的代码") 29 alert("http://www.google.com E-mail:cguanjun168@tom.com") 30 } 31 function help(){ //帮助按钮的效果 32 OpenWindow=window.open("", "newwin","height=420,width=470,toolbar=no,scrollbars="+scroll+",menubar=no"); 33 OpenWindow.document.write("<body bgcolor='white' text='black' alink='blue'vlink='blue' link='blue'><TITLE>提示</TITLE>") 34 OpenWindow.document.write("<center>把要显示的代码放到上页的输入框中,按显示按钮就能显示你的页面内容</center><br>") 35 OpenWindow.document.write("<center><a href='mailto:cguanjun168@tom.com' target='main'>Email me</a></Center><br>") 36 OpenWindow.document.write("<center><a href='javaform1:close()'>关闭窗口</a></Center>") 37 OpenWindow.document.close() 38 self.name="main" 39 } 40 </script> 41 <form name="form1"> 42 <textarea name="mytxt" rows="8" cols="50" 43 wrap="off"></textarea> 44 <br> 45 <input type="button" value="显示" onClick="test()"> 46 <input type="button" value="清除" onClick="clear()"> 47 <input type="button" value="关于" onClick="about()"> 48 <input type="button" value="帮助" onClick="help()"> 49 </form> 50 </body> 51 </html>