------------ 57.弹出窗口 方法一:<body onload="openwen()"> 浏览器读页面时弹出窗口; 方法二:<body onunload="openwen()"> 浏览器离开页面时弹出窗口; 方法三:用一个连接调用:<a href="#" onclick="openwin()">打开一个窗口</a> 注意:使用的"#"是虚连接。 方法四:用一个按钮调用:<input type="button" onclick="openwin()" value="打开窗口"> 何时装载script 58.动态改变字体的大小 function doZoom(size) { document.getElementById('zoom').style.fontSize=size+'px' }
function aa() { var newWin=window.open(url); newWin.document.form1.text1.value=value1; }改变弹出窗口上域的属性 opener.document.form2.text2.value=value2;改变父窗口的域的值 59.判断是何种浏览器 var name = navigator.appName; if (name == "Microsoft Internet Explorer") alert("IE"); else if (name == "Netscape") alert("NS");// 60.vbsscript确定框 <script language="VBScript"> <!-- MsgBox "确定删除吗?", 4 //--> </script>// 61.复制内容到剪切板 function JM_cc(bb) { var ob=eval("document.form1."+bb); ob.select(); js=ob.createTextRange(); js.execCommand("Copy"); }// 62.java中建立数据库连接取数据 public void init() { String url="jdbc:odbc:javadata"; try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection(url,"sa","");//mssql database user SA and password DatabaseMetaData dma=con.getMetaData(); System.out.println("Connect to"+dma.getURL()); System.out.println(";Driver "+dma.getDriverName()); System.out.println(";Version "+dma.getDriverVersion()); System.out.println(""); Statement stmt=con.createStatement(); ResultSet rs=stmt.executeQuery("select * from company.dbo.TB_NAME where number=1");//Sql rs.next(); String dispresult=rs.getString("name"); System.out.println(dispresult);// Instead,you can display it in Paint() or use AWT etc. rs.close(); stmt.close(); con.close(); } catch(SQLException ex) { System.out.println("!!!SQL Exception !!!"); while(ex!=null) { System.out.println("SQLState:"+ex.getSQLState()); System.out.println("Message:"+ex.getMessage()); System.out.println("Vendor:"+ex.getErrorCode()); ex=ex.getNextException(); System.out.println(""); } |