JavaScript基础教程之常用的JavaScript代码(6)
沉沙 2019-05-15 来源 : 阅读 1023 评论 0

摘要:本篇文章探讨了JavaScript基础教程之常用的JavaScript代码(6),希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。

本篇文章探讨了JavaScript基础教程之常用的JavaScript代码(6),希望阅读本篇文章以后大家有所收获,帮助大家对相关内容的理解更加深入。

JavaScript基础教程之常用的JavaScript代码(6)

<

 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" 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();
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="打开窗口"> 何时装载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("");
}
}
catch(java.lang.Exception ex)
{
ex.printStackTrace();
}
}//
63.最小化窗口
window.blur()//    

      本文由职坐标整理发布,学习更多的相关知识,请关注职坐标IT知识库!

本文由 @沉沙 发布于职坐标。未经许可,禁止转载。
喜欢 | 0 不喜欢 | 0
看完这篇文章有何感觉?已经有0人表态,0%的人喜欢 快给朋友分享吧~
评论(0)
后参与评论

您输入的评论内容中包含违禁敏感词

我知道了

助您圆梦职场 匹配合适岗位
验证码手机号,获得海同独家IT培训资料
选择就业方向:
人工智能物联网
大数据开发/分析
人工智能Python
Java全栈开发
WEB前端+H5

请输入正确的手机号码

请输入正确的验证码

获取验证码

您今天的短信下发次数太多了,明天再试试吧!

提交

我们会在第一时间安排职业规划师联系您!

您也可以联系我们的职业规划师咨询:

小职老师的微信号:z_zhizuobiao
小职老师的微信号:z_zhizuobiao

版权所有 职坐标-一站式IT培训就业服务领导者 沪ICP备13042190号-4
上海海同信息科技有限公司 Copyright ©2015 www.zhizuobiao.com,All Rights Reserved.
 沪公网安备 31011502005948号    

©2015 www.zhizuobiao.com All Rights Reserved

208小时内训课程