js技巧收集(200多个)
}
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>
---------------------------------------------------------------------------------------------------------
copyright dedecms
------------
织梦好,好织梦
57.弹出窗口
方法一:<body onload="openwen()"> 浏览器读页面时弹出窗口;
方法二:<body onunload="openwen()"> 浏览器离开页面时弹出窗口;
方法三:用一个连接调用:<a href="#" onclick="openwin()">打开一个窗口</a>
注重:使用的"#"是虚连接。
方法四:用一个按钮调用:<input type="button" onclick="openwin()" value="打开窗口"> 何时装载script
dedecms.com
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>// copyright dedecms
61.复制内容到剪切板
function JM_cc(bb)
{
var ob=eval("document.form1." bb);
ob.select();
js=ob.createTextRange();
js.execCommand("Copy");
}//
dedecms.com
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());
dedecms.com
System.out.println("Vendor:" ex.getErrorCode());
ex=ex.getNextException();
System.out.println("");
}
}
catch(java.lang.Exception ex)
{
ex.printStackTrace();
}
}//
63.最小化窗口
window.blur()//
文章评论
共有位Admini5网友发表了评论 查看完整内容