ki1381哥们的C#开发短信收发软件的原理

时间:2025-02-28 07:29:56

1、文本框焦点问题onBlur:当失去输入焦点后产生该事件onFocus:当输入获得焦点后,产生该文件Onchange:当文字值改变时,产生该事件Onselect:当文字加亮后,产生该文件点击时文字消失,失去焦点时文字再出现网页按钮的特殊颜色鼠标移入移出时颜色变化平面按钮按钮颜色变化平面输入框使窗口变成指定的大小使文字上下滚动*状态栏显示该页状态可以点击文字实现radio选项的选定
    情侣:一次注册两个帐户
可以在文字域的font写onclick事件打印打印网页线型输入框显示文档最后修改日期functionhi(str){ document.write(document.lastModified) alert("hi"+str+"!")}可以在鼠标移到文字上时就触发事件ChangingBackgroundColors
 

    将按钮的特征改变本例按钮的代码如下:改变按钮的图片.本例的按钮代码如下:打印页面打印本稿
可以直接写html语言document.write("");改变下拉框的颜色转至目标URLwindow.location="http://guoguo/"传递该object的formUpdateSN('guoqiang99267',this.form)functionUpdateSN(strValue,strForm){  strForm.SignInName.value=strValue;  returnfalse;}文字标签guoqiang99859layer2为组件的ID,可以控制组件是否可见document.all.item('Layer2').style.display="block";document.all.item('Layer2').style.display="none";//将页面加入favorite中//过10秒自动关闭页面functioncloseit(){setTimeout("self.close()",}可以比较字符的大小char=post.charAt(i);if(!('0'<=char&&char<='9'))将字符转化为数字month=parseInt(char)点击value非空的选项时转向指定连接     主办单位        北京日报    北京晚报改变背景颜色改变文字输入框的背景颜色改变水平线的特征传递参数的方式8页内跳转1234567dfdfdfdf//两个按键一起按下if(event.ctrlKey&&window.event.keyCode==//刷新页面javascript:this.location.reload()//将网页的按钮使能functionhaha(){ for(vari=0;i文字移动双击网页自动跑varcurrentpos,timer;functioninitialize(){ timer=setInterval("scrollwindow()",;}functionsc(){ clearInterval(timer);}functionscrollwindow(){ currentpos=document.body.scrollTop; window.scroll(++currentpos); if(currentpos!=document.body.scrollTop)  sc();}document.onmousedown=scdocument.ondblclick=initialize//后退前进刷新转向指定网页document.location="http://ww/"或者document.location.assign("http://guoguo.com/")在网页上显示实时时间varclock_id;window.onload=function(){ clock_id=setInterval("document.formtxtclock.value=(newDate);",}//可以下载文件document.location.href="目标文件"//连接数据库importjava.sql.*;StringmyDBDriver="sun.jdbc.odbc.JdbcOdbcDriver";Class.forName(myDBDriver);Connectionconn=DriverManager.getConnection("jdbc:odbc:firm","username","password");Statementstmt=conn.createStatement();ResultSetrs=stmt.executeQuery(sql);rs.getString("column1");//可以直接在页面“div”内写下所需内容*'">
//可以改变页面上的连接的格式,使其为双线完整的css新建frame 

2、动态修改CSS的另一种方式this.runtimeStyle.cssText="color:#990000;border:1pxsolid#cccccc";//正则表达式匹配中文字符的正则表达式:[/u4e00-/u9fa5]匹配双字节字符(包括汉字在内):[^/x00-/xff]应用:计算字符串的长度(一个双字节字符长度计ASCII字符计?String.prototype.len=function(){returnthis.replace([^/x00-/xff]/g,"aa").length;}匹配空行的正则表达式:/n[/s|]*/r匹配HTML标记的正则表达式:/<(.*)>.*|<(.*)//>/匹配首尾空格的正则表达式:(^/s*)|(/s*$)应用:javascript中没有像vbscript那样的trim函数,我们就可以利用这个表达式来实现,如下:String.prototype.trim=function(){    returnthis.replace(/(^/s*)|(/s*$)/g,"");}利用正则表达式分解和转换IP地址:下面是利用正则表达式匹配IP地址,并将IP地址转换成对应数值的Javascript程序:functionIP2V(ip){ re=/(/d+)/.(/d+)/.(/d+)/.(/d+)/g//匹配IP地址的正则表达式if(re.test(ip)){returnRegExp.$1*Math.pow(+RegExp.$2*Math.pow(+RegExp.$3*255+RegExp.$4*1}else{ thrownewError("NotavalidIPaddress!")}}不过上面的程序如果不用正则表达式,而直接用split函数来分解可能更简单,程序如下:varip="168"ip=ip.split(".")alert("IP值是:"+(ip[0]*255*255*255+ip[1]*255*255+ip[2]*255+ip[3]*匹配Email地址的正则表达式:/w+([-+.]/w+)*@/w+([-.]/w+)*/./w+([-.]/w+)*匹配网址URL的正则表达式:http://([/w-]+/.)+[/w-]+(/[/w-./?%&=]*)?//利用正则表达式去除字串中重复的字符的算法程序:vars="abacabefgeeii"vars1=s.replace(/(.).*/1/g,"$1")varre=newRegExp("["+s1+"]","g")vars2=s.replace(re,"")alert(s1+s//结果为:abcefgi思路是使用后向引用取出包括重复的字符,再以重复的字符建立第二个表达式,取到不重复的字符,两者串连。这个方法对于字符顺序有要求的字符串可能不适用。//得用正则表达式从URL地址中提取文件名的javascript程序,如下结果为page1s="http://www.net/pagehtm"s=s.replace(/(.*//){}([^/.]+).*/ig,"$2")alert(s)/利用正则表达式限制网页表单里的文本框输入内容:用正则表达式限制只能输入中文:onkeyup="value=value.replace(/[^/u4E00-/u9FA5]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/u4E00-/u9FA5]/g,''))"用正则表达式限制只能输入全角字符:onkeyup="value=value.replace(/[^/uFF00-/uFFFF]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/uFF00-/uFFFF]/g,''))"用正则表达式限制只能输入数字:onkeyup="value=value.replace(/[^/d]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/d]/g,''))"用正则表达式限制只能输入数字和英文:onkeyup="value=value.replace(/[/W]/g,'')"onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^/d]/g,''))"设置和使用cookie设置与读取cookies...
写入cookie的值
functionSet(){varThen=newDate()Then.setTime(Then.getTime()+60*//60秒document.cookie="Cookie1="+gg.value+";expires="+Then.toGMTString()}functionGet(){ varcookieString=newString(document.cookie) varcookieHeader="Cookie1=" varbeginPosition=cookieString.indexOf(cookieHeader) if(beginPosition!=- {  document.all.Textbox.value=cookieString.substring(beginPosition+cookieHeader.length) } else  document.all.Textbox.value="Cookie未找到!"}//取月的最后一天functiongetLastDay(year,month){ //取年 varnew_year=year; //取到下一个月的第一天,注意这里传入的month是从??12 varnew_month=month++; //如果当前是12月,则转至下一年 if(month> {  new_month-=12;  new_year++; } varnew_date=newDate(new_year,new_month,; return(newDate(new_date.getTime()-1000*60*60*getDate();}//判断当前的焦点是组中的哪一个for(vari=0;i<3;i++) if(event.srcElement==bb[i])  break;// 实现类packagecom.baosight.view.utils;importjavax.servlet.jsp.tagext.TagSupport;importjavax.servlet.http.HttpSession;publicclassMytagextendsTagSupport{  publicintdoStartTag()throwsjavax.servlet.jsp.JspException  {    booleancanAccess=false;    HttpSessionsession=pageContext.getSession();    if(canAccess)    {      returnEVAL_BODY_INCLUDE;    }    else    {      returnthis.SKIP_BODY;    }  }}在web.xml中添加定义      guoguo    /WEB-INF/abc.tld  标签库中定义abc.tld 0 1 hr guoguo Extra3TagLibrary   mytag  com.baosight.view.utils.Mytag     id2   true            true   在使用自定义标签的页面中加入自己定义的标签,<%@tagliburi="guoguo"prefix="guoguo"%>//自己定义标签显示带边框的集  查询条件dfdfdf//?文件(F)】菜单中的命令的实现?打开〗命令的实现[格式]:document.execCommand("open")[说明]这跟VB等编程设计中的webbrowser控件中的命令有些相似,大家也可依此琢磨琢磨。[举例]在之间加入:打开?使用记事本编辑〗命令的实现[格式]:location.replace("view-source:"+location)[说明]打开记事本,在记事本中显示该网页的源代码。[举例]在之间加入:使用记事本编辑?另存为〗命令的实现[格式]:document.execCommand("saveAs")[说明]将该网页保存到本地盘的其它目录![举例]在之间加入:另存为?打印〗命令的实现[格式]:document.execCommand("print")[说明]当然,你必须装了打印机![举例]在之间加入:打印?关闭〗命令的实现[格式]:window.close();returnfalse[说明]将关闭本窗口。[举例]在之间加入:关闭本窗口?编辑(E)】菜单中的命令的实现〖全选〗命令的实现[格式]:document.execCommand("selectAll")[说明]将选种网页中的全部内容![举例]在之间加入:全选?查看(V)】菜单中的命令的实现?刷新〗命令的实现[格式]:location.reload()或history.go([说明]浏览器重新打开本页。[举例]在之间加入:刷新或加入:刷新?源文件〗命令的实现[格式]:location.replace("view-source:"+location)[说明]查看该网页的源代码。[举例]在之间加入:查看源文件?全屏显示〗命令的实现[格式]:window.open(document.location,"url","fullscreen")[说明]全屏显示本页。[举例]在之间加入:全屏显示?收藏(A)】菜单中的命令的实现?添加到收藏夹〗命令的实现[格式]:window.external.AddFavorite('url','“网站名”)[说明]将本页添加到收藏夹。[举例]在之间加入:添加到收藏夹?整理收藏夹〗命令的实现[格式]:window.external.showBrowserUI("OrganizeFavorites",null)[说明]打开整理收藏夹对话框。[举例]在之间加入:整理收藏夹?工具(T)】菜单中的命令的实现〖internet选项〗命令的实现[格式]:window.external.showBrowserUI("PrivacySettings",null)[说明]打开internet选项对话框。[举例]在之间加入:internet选项?工具栏】中的命令的实现?前进〗命令的实现[格式]history.go(或history.forward()[说明]浏览器打开后一个页面。[举例]在之间加入:前进或加入:前进?后退〗命令的实现[格式]:history.go(-或history.back()[说明]浏览器返回上一个已浏览的页面。[举例]在之间加入:后退或加入:后退?刷新〗命令的实现[格式]:document.reload()或history.go([说明]浏览器重新打开本页。[举例]在之间加入:刷新或加入:刷新其它命令的实现〖定时关闭本窗口〗命令的实现[格式]:settimeout(window.close(),关闭的时间)[说明]将关闭本窗口。[举例]在之间加入:3秒关闭本窗口【附】为了方便读者,下面将列出所有实例代码,你可以把它们放到一个html文件中,然后预览效果。打开
使用记事本编辑
另存为
打印
关闭本窗口
全选
刷新刷新
查看源文件
全屏显示
添加到收藏夹
整理收藏夹
internet选项
前进1前进2
后退1后退2
3秒关闭本窗口
给DHTML中的标签添加一个新的属性,可以随意加//xmlhttp技术此方法是通过XMLHTTP对象从服务器获取XML文档,示例如下。   functiongetDatal(url){ varxmlhttp=newActiveXObject("Microsoft.XMLHTTP");//创建XMLHTTPRequest对象 xmlhttp.open("GET",url,false,"","");//使用HTTPGET初始化HTTP请求 xmlhttp.send("");//发送HTTP请求并获取HTTP响应 returnxmlhttp.responseXML;//获取XML文档 } //服务器端通过request.getReader()获得传入的字符串在java中使用正则表达式java.util.regex.Patternp=java.util.regex.Pattern.compile("file://d+|.//d+|//d+.//d*|(E|//d+E|.//d+E|//d+.//d*E)((//+|-)//d|//d)//d*");java.util.regex.Matcherm=p.matcher("E+3");booleanresult=m.matches();//给下拉框分组//加注音基准文本注音文本//加删除线此文本将带删除线显示。//取frame中的event事件document.frames("workspace").event.keyCode//是弹出方法的定义String.prototype.trim=function(){ returnthis.replace(/(^/s*)|(/s*$)/g,"");}alert("".trim)// 防止网页被包含if(window!=window.top)top.location.href=location.href;//让网页一直在frame里面if(window==window.top){ document.body.innerHTML="

请通过正常方式访问本页面!

"; //window.close();}//

3、饼图functionshow(pie){pie.strokecolor=pie.fillcolor;pie.strokeweight=10;divinnerHTML=""+pie.id+""+pie.title+"";}functionhide(pie){pie.strokecolor="white";pie.strokeweight=1;divinnerHTML="";}asp技术phpjspc#写的.netWEB程序vb.net写的.netWEB程序xml技术         

//是一个特殊的容器,想装个网页都行//button外部的html代码event.srcElement.outerHTML//标识当前的IE事件的触发器event.srcElement和event.keyCode//事件类型event.type//动态改变类型//页面翻转//滚屏parent.scroll(x,y);////改变状态栏self.status="";//改变窗口大小window.resizeTo(;//改变鼠标样式styleBODY{CURSOR:url('mouse.ani');SCROLLBAR-BASE-COLOR:#506AA8;SCROLLBAR-ARROW-COLOR:#14213F;}//背景透明//鼠标为等待形状//调用父窗口的函数opener.fucntion1();//body的内部html代码//框架中调用父窗口的函数//交换节点CELL_1CELL_2
//删除节点CELL_1CELL_2
//添加节点addNode()//获得事件的父与子标签event.srcElement.children[0]和event.srcElement.parentElement//集中为按钮改变颜色//判断是左键还是右键被按下//获得操作系统的名称和浏览器的名称document.write(navigator.userAgent)//alt/ctrl/shift键按下event.altKey//按下alt键event.ctrlKey//按下ctrl键event.shiftKey//按下shift键 将当前位置定位为C盘。{window.location="c:"}//返回输入框的类型模拟控件的单击事件//取出记录集的列名java.sql.ResultSetrset=com.bsitc.util.DBAssist.getIT().executeQuery(queryStatement,conn);java.sql.ResultSetMetaDatametaData=rset.getMetaData();intcount=metaData.getColumnCount();Stringname=metaData.getColumnName(i);Stringvalue=rset.getString(i);//格式化数字functionformat_number(str,digit){ if(isNaN(str)) {  alert("您传入的值不是数字!");  return0; } elseif(Math.round(digit)!=digit) {  alert("您输入的小数位数不是整数!");  return0; } else  returnMath.round(parseFloat(str)*Math.pow(digit))/Math.pow(digit);}回车按钮转化为tab按钮if(event.keyCode==event.keyCode=9;//将滚动条滚动Scroll
111111111111111//判断是什么对象if(typeof(unknown)=="function")returntrue;if(typeof(unknown)!="object")returnfalse;//取消文本框自动完成功能//让下拉框自动下拉123//读取XML文件varchildrenobj=myselect//document.all.myselect;    varoXMLDoc=newActiveXObject('MSXML');    oXMLDoc.url="mymsg.xml";    varoRoot=oXMLDoc.root;    if(oRoot.children!=null) {        for(vari=0;i杭州地区温州地区台州地区丽水地区//点击图片,图片停止//显示本地计算机信息varWshNetwork=newActiveXObject("WScript.Network");alert("Domain="+WshNetwork.UserDomain);alert("ComputerName="+WshNetwork.ComputerName);alert("UserName="+WshNetwork.UserName);//比较时间  tDate=newDate(;//年,月,日,时,分  dDate=newDate();  tDatedddd//注意不能通过与undefined做比较来测试一个变量是否存在,虽然可以检查它的类型是否为“undefined”。在以下的代码范例中,假设程序员想测试是否已经声明变量x://这种方法不起作用if(x==undefined)    //作某些操作//这个方法同样不起作用-必须检查//字符串"undefined"if(typeof(x)==undefined)    //作某些操作//这个方法有效if(typeof(x)=="undefined")    //作某些操作创建具有某些属性的对象varmyObject=newObject();myObject.name="James";myObject.age="22";myObject.phone="5551234";//枚举(循环)对象的所有属性for(varainmyObject){    //显示"Theproperty'name'isJames",等等。    window.alert("Theproperty'"+a+"'is"+myObject[a]);}//判断一个数字是否是整数vara=2;alert(a%1==//新建日期型变量vara=newDate(;alert(a.toLocaleDateString());

4、加为首页//xml数据岛操作  HTML中的数据岛中的记录集      

HTML中的XML数据岛记录编辑与添加
    
  酒店名称:
  地址:
  主页:
  电子邮件:
  电话:
  级别:
      "onclick="theXMLisland.recordset.moveNext()">  >"onclick="theXMLisland.recordset.moveLast()">           四海大酒店  
海魂路1号
  www.sihaohotel.com.cn  master@sihaohotel.com.cn  (8888888  五星级  
    五湖宾馆  
东平路99号
  www.wuhu.com.cn  web@wuhu.com.cn  (1111666  四星级  
    “大沙漠”宾馆  
留香路168号
  www.dashamohotel.com.cn  master@dashamohotel.com.cn  (87878788  五星级  
    “画眉鸟”大酒店  
血海飘香路2号
  www.throstlehotel.com.cn  chuliuxiang@throstlehotel.com.cn  (9886666  五星级  
  
      //xml数据岛中添加记录-------------------------------  ThefollowinglistisasampleofthepropertiesandmethodsthatyouusetoaccessnodesinanXMLdocument.Property/MethodDescriptionXMLDocumentReturnsareferencetotheXMLDocumentObjectModel(DOM)exposedbytheobject.documentElementReturnsthedocumentrootoftheXMLdocument.childNodesReturnsanodelistcontainingthechildrenofanode(ifany).itemAccessesindividualnodeswithinthelistthroughanindex.Indexvaluesarezero-based,soitem(returnsthefirstchildnode.textReturnsthetextcontentofthenode.ThefollowingcodeshowsanHTMLpagecontaininganXMLdataisland.Thedataislandiscontainedwithintheelement.      HTMLwithXMLDataIsland        

WithinthisdocumentisanXMLdataisland.

                  AdventureWorks        AlpineSkiHouse          
  Foranexample,youcancutandpastethissamplelineofcode:resortXML.XMLDocument.documentElement.childNodes.item(text//读取页面上的XML数据岛中的数据resortXML.documentElement.childNodes.item(getAttribute("code")//读取页面上的XML数据岛中的数据resortXML.documentElement.childNodes[0].getAttribute("code")//读取页面上的XML数据岛中的数据模式窗口父窗口varurl="aaa.jsp";vardata=showModalDialog(url,null,"dialogHeight:400px;dialogHeight:600px;center:yes;help:No;status:no;resizable:Yes;edge:sunken");if(data) alert(data.value); 子窗口vardata=newObject();data.value1="china";window.returnValue=data;window.close();动态设置事件,带参数//将url转化为16进制形式 varret=''; for(vari=0;isdsdsdsdsdsdsdsds

//放置在页面的最右边//通过style来控制隔行显示不同颜色     //全屏最大化newwindow=window.open("","","scrollbars")if(document.all){ newwindow.moveTo( newwindow.resizeTo(screen.width,screen.height)}//根据名字解析xml中的节点值varXMLDoc=newActiveXObject("MSXML");XMLDoc.url="d:/abc.xml";aRoot=XMLDoc.root;ainnerText=aRoot.children.item("name").text;//在页面上解析xml的值http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/5996c682-3472-4b03-9fb0-1e08fcccdfasp//看一个字符串里面有多少个回车符,返回值是一个数组vars=value.match(//n/g);if(s)if(s.length=={alert('10行了');returnfalse;}//获得asc码vars='aa';alert(s.charCodeAt(// 文字居右对齐//判断一个方法是否存在functionpageCallback(response){ alert(response);}if(pageCallback) alert(//判断一个变量是否定义if(typeof(a)=="undefined"){ alert()}//javascript执行本机的可执行程序,需设置为可信或者降低IE安全级别调用方式测试// 弹出新页面,关闭旧页面,不弹出提示框 varw=screen.availWidth-10;   varh=screen.availHeight-10;   varswin=window.open("/mc/mc/message_management.jsp","BGSMbest","scrollbars=yes,status,location=menubar=toolbar=resizable=no,top=left=height="+h+",width="+w);   window.opener=null;   window.close();//能输入的下拉框asdfasfadf546546//在方法中定义全局变量functionglobalVar(script){        eval(script);//allnavigators  //window.execScript(script);//forieonly}globalVar('window.haha="../system";');alert(haha);//在方法中定义全局变量,其中的haha就是全局变量了显示一个对象的全部的属性和属性的值vara=newObject();a.name='a1';a.***='mail'for(varpina){ alert(p+"="+a[p])}//16进制转换成10进制varn=parseInt("2AE",;//这里将16进制的2AE转成10进制数,得到n的值是复制粘贴
//获得对象类型switch(object.constructor){   caseDate:   ...   caseNumber:   ...   caseString:   ...   caseMyObject:   ...   default:   ...}//图片加载失败时重新加载图片// //font_effect.htc//定义一个保存字体颜色的变量varcolor;functionglowit(){ color=element.style.backgroundColor; element.style.backgroundColor='white'}functionnoglow(){  element.style.backgroundColor=color}//abc.csstr{behavior:url(font_effect.htc);}可以通过css和htc改变表格的颜色,仅IE支持//xxx.html 1 2 3 4 5 6//在页面上画点functiona(x,y,color){ document.write("")}// 自动关闭网页

5、向文件中写内容<%@pageimport="java.io.*"%><% Stringstr="printme"; //alwaysgivethepathfromroot.Thiswayitalmostalwaysworks. StringnameOfTextFile="/usr/anil/imp.txt"; try {  PrintWriterpw=newPrintWriter(newFileOutputStream(nameOfTextFile));  pw.println(str);  //cleanup  pw.close(); } catch(IOExceptione) {  out.println(e.getMessage()); }%>先读文件再写文件<%@pagelanguage="java"%><%@pagecontentType="text/html;charSet=gb2312"%><%@pageimport="java.util.*"%><%@pageimport="java.lang.*"%><%@pageimport="javax.servlet.*"%><%@pageimport="javax.servlet.jsp.*"%><%@pageimport="javax.servlet.http.*"%><%@pageimport="java.io.*"%>eryrytry<% intcount=0; FileInputStreamfi=newFileInputStream("count.txt"); ObjectInputStreamsi=newObjectInputStream(fi); count=si.readInt(); count++; out.print(count); si.close(); FileOutputStreamfo=newFileOutputStream("count.txt"); ObjectOutputStreamso=newObjectOutputStream(fo); so.writeInt(count); so.close();%>直线型输入框可以将背景改为按钮性状,通过改变css改变属性录音笔同时按下CTRL和Q键document.onkeydown=function(){if(event.ctrlKey&&event.keyCode=={alert(}}//以下是一个完整的显示hint的代码,其思想是当鼠标停留是将div中的内容显示在鼠标出,当鼠标移出后在将该div隐藏掉---------------------------------------------------------------------------------------------------------------------dfdfd

---------------------------------------------------------------------------------------------------------------------弹出窗口方法一:浏览器读页面时弹出窗口;方法二:浏览器离开页面时弹出窗口;方法三:用一个连接调用:打开一个窗口注意:使用的"#"是虚连接。方法四:用一个按钮调用:何时装载script动态改变字体的大小functiondoZoom(size){   document.getElementById('zoom').style.fontSize=size+'px'}functionaa(){   varnewWin=window.open(url);   newWin.document.formtextvalue=value1;}改变弹出窗口上域的属性opener.document.formtextvalue=value2;改变父窗口的域的值判断是何种浏览器varname=navigator.appName;if(name=="MicrosoftInternetExplorer") alert("IE");elseif(name=="Netscape") alert("NS");//vbsscript确定框//复制内容到剪切板functionJM_cc(bb){    varob=eval("document.form"+bb);    ob.select();    js=ob.createTextRange();    js.execCommand("Copy");}//java中建立数据库连接取数据publicvoidinit(){ Stringurl="jdbc:odbc:javadata"; try {  Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");  Connectioncon=DriverManager.getConnection(url,"sa","");//mssqldatabaseuserSAandpassword  DatabaseMetaDatadma=con.getMetaData();  System.out.println("Connectto"+dma.getURL());  System.out.println(";Driver"+dma.getDriverName());  System.out.println(";Version"+dma.getDriverVersion());  System.out.println("");  Statementstmt=con.createStatement();  ResultSetrs=stmt.executeQuery("select*fromcompany.dbo.TB_NAMEwherenumber=1");//Sql  rs.next();  Stringdispresult=rs.getString("name");  System.out.println(dispresult);//Instead,youcandisplayitinPaint()oruseAWTetc.  rs.close();  stmt.close();  con.close(); } catch(SQLExceptionex) {  System.out.println("!!!SQLException!!!");  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.Exceptionex) {  ex.printStackTrace(); }}//最小化窗口window.blur()//文档的路径document.URL//定时执行某段程序setTimeout("change_color()",;设置为主页functionmakeHome(){  netscape.security.PrivilegeManager.enablePrivilege("UniversalPreferencesWrite");  navigator.preference("browser.startup.homepage",location.href);}//设置为收藏functionaddFav(){  if(ie)    window.external.AddFavorite(location.href,'WWW.OGRISH.COM:GROTESQUEMOVIESANDPICTURES');  if(ns)    alert("Thanksforthebookmark!/n/nNetscapeusersclickOKthenpressCTRL-D");}//判断cookie是否可用navigator.cookieEnabled;//显示有模式的有页面的弹出窗口functionsetbgcolor_onclick(){ varcolor=showModalDialog("/mailpage/compose/colorsel.html","help=0"); if(color!=null) {  document.compose.bgcolor.value=color; }}//截取小数点后两位vara=4454545;alert(a.toFixed(;//禁止选择页面上的文字来拷贝//屏蔽右键菜单oncontextmenu="event.returnValue=false"//事件禁止起泡event.cancelBubble=true//禁止在输入框打开输入法//屏蔽汉字和空格//用javascript判断文件是否存在functionExists(filespec){ if(filespec) {  varfso;  fso=newActiveXObject("Scripting.FileSystemObject");  alert(fso.FileExists(filespec)); }}选择图片

//获得当前的文本框选中的文字//跳转至目标页面,同时不可返回sohu.com//获得当前的行是表格的第几行                                                //删除表格某行,xx表示某行,下标从0开始计算document.all.myTable.deleteRow(xx)//动态的向表格中添加行functionadd(){   tinsertRow().insertCell().innerHTML='';}// event.x,event.clientX,event.offsetX区别:x:设置或者是得到鼠标相对于目标事件的父元素的外边界在x坐标上的位置。clientX:相对于客户区域的x坐标位置,不包括滚动条,就是正文区域。offsetx:设置或者是得到鼠标相对于目标事件的父元素的内边界在x坐标上的位置。screenX:相对于用户屏幕。显示是鼠标按钮的哪个点Mouse看看//打开C盘// 当前屏幕的分辨率screen.width、screen.height//设置表格中的内容tbl.rows[0].cells[1].innerText=document.form.textvalue;//本地快捷键

网上邻居

我的电脑

我的文档

回收站

控制面板

拨号网络(windows

IE菜单0//改变按钮上的图片//创建新连接//打印//另存为htm//另存为txtdocument.execCommand("SaveAs")//保存为document.execCommand('undo')//撤销上一次操作web对话框//取第x,y的值//向新打开的网页上写内容newwin=window.open('about:blank','','top=10');newwin.document.write('');//返回javascript:history.go(-;//将页面上选中的内容复制到剪贴板abcdefg//将页面上选中的内容复制到剪贴板kjhkjhkhkj鼠标移到下拉框时自动全部打开//获得本机的文件varfso=newActiveXObject("Scripting.FileSystemObject");varf1=fso.GetFile("C://bsitcdata//ejbhome.xml");alert("Filelastmodified:"+fDateLastModified);//判断客户端是否是IE浏览器因为document.all是IE的特有属性,所以通常用这个方法来判断客户端是否是IE浏览器,document.all?0;创建新的下拉框选项newOption(text,value)这样的函数//在页面上画柱状图mathstr=12;document.write("
 %"+mathstr+"
4人")
%12
4人
%12
4人//

6、给类定义新的方法functiontrim_1(){  returnthis.replace(/(^/s*)|(/s*$)/g,"");}String.prototype.trim=trim_1;alert('cindy'.trim());定义一个将日期类型转化为字符串的方法functionguoguo_date(){ vartmptmp2; tmp1=this.getMonth()+1+""; if(tmplength<  tmp1="0"+tmp1; tmp2=this.getDate()+""; if(tmplength<  tmp2="0"+tmp2;  returnthis.getYear()+"-"+tmp1+"-"+tmp2;}Date.prototype.toLiteString=guoguo_date;alert(newDate().toLiteString()) pasta是有四个参数的构造器,定义对象。functionpasta(grain,width,shape,hasEgg){    //是用什么粮食做的?    this.grain=grain;    //多宽?(数值)    this.width=width;    //横截面形状?(字符串)    this.shape=shape;    //是否加蛋黄?(boolean)    this.hasEgg=hasEgg;    //定义方法    this.toString=aa;}functionaa(){ ;}//定义了对象构造器后,用new运算符创建对象实例。varspaghetti=newpasta("wheat","circle",true);varlinguine=newpasta("wheat","oval",true);//补充定义属性,spaghetti和linguine都将自动获得新的属性pasta.prototype.foodgroup="carbohydrates";打印出错误原因try{ x=y//产生错误。}catch(e){   document.write(e.description)//打印"'y'isundefined".}//生成EXCEL文件并保存varExcelSheet;ExcelApp=newActiveXObject("Excel.Application");ExcelSheet=newActiveXObject("Excel.Sheet");//本代码启动创建对象的应用程序(在这种情况下,MicrosoftExcel工作表)。一旦对象被创建,就可以用定义的对象变量在代码中引用它。在下面的例子中,通过对象变量ExcelSheet访问新对象的属性和方法和其他Excel对象,包括Application对象和ActiveSheet.Cells集合。//使Excel通过Application对象可见。ExcelSheet.Application.Visible=true;//将一些文本放置到表格的第一格中。ExcelSheet.ActiveSheet.Cells(Value="ThisiscolumnA,row1";//保存表格。ExcelSheet.SaveAs("C://TEST.XLS");//用Application对象用Quit方法关闭Excel。ExcelSheet.Application.Quit();//根据标签获得一组对象varcoll=document.all.tags("DIV");if(coll!=null){for(i=0;i//不通过form,直接通过名字引用对象//使鼠标滚轮失效functiondocument.onmousewheel(){ returnfalse;}// 创建弹出窗口  varoPopup=window.createPopup();  varoPopupBody=oPopup.document.body;  oPopupBody.innerHTML="DisplaysomeHTMLhere.";  oPopup.show(document.body);//取得鼠标所在处的对象varobj=document.elementFromPoint(event.x,event.y);//获得左边的对象//定位鼠标document.all.hint_layer.style.left=event.x+document.body.scrollLeft+10;document.all.hint_layer.style.top=event.y+document.body.scrollTop+10;//向下拉框指定位置添加项目varop=document.createElement("OPTION");document.all.selected_items.children(index).insertAdjacentElement("BeforeBegin",op);op.text=document.all.all_items[i].text;op.value=document.all.all_items[i].value;//判断一个窗口是否已经打开,如果已经打开,则关闭之vara;if(a) a.close();else a=window.open('','','');//动态创建一个标签newElem=document.createElement("DIV");newElem.;document.body.appendChild(newElem);document.all.hint_layer.innerText="guoguo";//标题栏document.title//背景图片//背景图片不动//背景图片居中设置透明效果document.form.xxx.filters.alpha.opacity=??100//定义方法vardragapproved=false;document.onmouseup=newFunction("dragapproved=false");// 将数字转化为人民币大写形式functionconvertCurrency(currencyDigits){//Constants: varMAXIMUM_NUMBER=99; //Predefinetheradixcharactersandcurrencysymbolsforoutput: varCN_ZERO="零"; varCN_ONE="壹"; varCN_TWO="贰"; varCN_THREE="叁"; varCN_FOUR="肆"; varCN_FIVE="伍"; varCN_SIX="陆"; varCN_SEVEN="柒"; varCN_EIGHT="捌"; varCN_NINE="玖"; varCN_TEN="拾"; varCN_HUNDRED="佰"; varCN_THOUSAND="仟"; varCN_TEN_THOUSAND="万"; varCN_HUNDRED_MILLION="亿"; varCN_SYMBOL="人民币"; varCN_DOLLAR="元"; varCN_TEN_CENT="角"; varCN_CENT="分"; varCN_INTEGER="整"; //Variables: varintegral;//Representintegralpartofdigitnumber. vardecimal;//Representdecimalpartofdigitnumber. varoutputCharacters;//Theoutputresult. varparts; vardigits,radices,bigRadices,decimals; varzeroCount; vari,p,d; varquotient,modulus; //Validateinputstring: currencyDigits=currencyDigits.toString(); if(currencyDigits==""){  alert("Emptyinput!");  return""; } if(currencyDigits.match(/[^,./d]/)!=null){  alert("Invalidcharactersintheinputstring!");  return""; } if((currencyDigits).match(/^((/d{3}(,/d{3})*(.((/d{3},)*/d{3}))?)|(/d+(./d+)?))$/)==null){  alert("Illegalformatofdigitnumber!");  return""; } //Normalizetheformatofinputdigits: currencyDigits=currencyDigits.replace(/,/g,"");//Removecommadelimiters. currencyDigits=currencyDigits.replace(/^0+/,"");//Trimzerosatthebeginning. //Assertthenumberisnotgreaterthanthemaximumnumber. if(Number(currencyDigits)>MAXIMUM_NUMBER){  alert("Toolargeanumbertoconvert!");  return""; } //Processthecoversionfromcurrencydigitstocharacters: //Separateintegralanddecimalpartsbeforeprocessingcoversion: parts=currencyDigits.split("."); if(parts.length>{  integral=parts[0];  decimal=parts[1];  //Cutdownredundantdecimaldigitsthatareafterthesecond.  decimal=decimal.substr(; } else{  integral=parts[0];  decimal=""; } //Preparethecharacterscorrespondingtothedigits: digits=newArray(CN_ZERO,CN_ONE,CN_TWO,CN_THREE,CN_FOUR,CN_FIVE,CN_SIX,CN_SEVEN,CN_EIGHT,CN_NINE); radices=newArray("",CN_TEN,CN_HUNDRED,CN_THOUSAND); bigRadices=newArray("",CN_TEN_THOUSAND,CN_HUNDRED_MILLION); decimals=newArray(CN_TEN_CENT,CN_CENT); //Startprocessing: outputCharacters=""; //Processintegralpartifitislargerthan if(Number(integral)>{  zeroCount=0;  for(i=0;i    {     outputCharacters+=digits[0];    }    zeroCount=0;    outputCharacters+=digits[Number(d)]+radices[modulus];   }   if(modulus==0&&zeroCount<{    outputCharacters+=bigRadices[quotient];   }  }  outputCharacters+=CN_DOLLAR; } //Processdecimalpartifthereis: if(decimal!=""){  for(i=0;i接收人发送人主题内容表格的结束

//cd_catalog.xml     EmpireBurlesque  BobDylan  USA  Columbia  90  1985     Hideyourheart  BonnieTyler  UK  CBSRecords  90  1988     GreatestHits  DollyParton  USA  RCA  90  1982     Stillgottheblues  GaryMoore  UK  Virginrecords  20  1990  //以下组合可以正确显示汉字================================xml保存编码xml页面指定编码ANSIgbk/GBK、gb2312Unicodeunicode/UnicodeUTF-8UTF-8================================XML操作