常见的JavaScript代码(六)

文章来自“PHP中文网”

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"><fontcolor="#000000">录音笔</font></a></td><style>.mouseoverbt{background-image: url();

background-repeat: no-repeat;}.mouseout{background-color: #E0E0E0;}</style>55.同时按下CTRL和Q键document.onkeydown=function(){if(event.ctrlKey&&event.keyCode==81){alert(1)}}//56.以下是一个完整的显示hint的代码,其思想是当鼠标停留是将div中的内容显示在鼠标出,当鼠标移出后在将该div隐藏掉。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><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>———————————————————————————————————————57.弹出窗口方法一:<body onload="openwen()"> 浏览器读页面时弹出窗口;方法二:<body onunload="openwen()"> 浏览器离开页面时弹出窗口;方法三:用一个连接调用:<a href="#" onclick="openwin()">打开一个窗口</a>注意:使用的"#"是虚连接。方法四:用一个按钮调用:<input type="button" onclick="openwin()" value="打开窗口"> 何时装载script58.动态改变字体的大小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 passwordDatabaseMetaData 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");//Sqlrs.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("");}}catch(java.lang.Exception ex){ex.printStackTrace();}}//63.最小化窗口window.blur()//

,你要以乐观的态度看待这个世界,你会发现世界是如此得美好

常见的JavaScript代码(六)

相关文章:

你感兴趣的文章:

标签云: