188.服務器端通過request.getReader()獲得傳入的字符串

189.在java中使用正則表達式
java.util.regex.Pattern p =


java.util.regex.Pattern.compile("\\d+|.\\d+|\\d+.\\d*|(E|\\d+E|.\\d+E|\\d+.\\d*E)((\\+|-)\\d|\\d)\\d*");
java.util.regex.Matcher m = p.matcher("12.E+3");
boolean result = m.matches();//


190.給下拉框分組
<Select>
<OPTGROUP LABEL="堿性金屬">
<OPTION>鋰 (Li)</OPTION>
<OPTION>納 (Na)</OPTION>
<OPTION>鉀 (K)</OPTION>
</OPTGROUP>
<OPTGROUP LABEL="鹵素">
<OPTION>氟 (F)</OPTION>
<OPTION>氯 (Cl)</OPTION>
<OPTION>溴 (Br)</OPTION>
</OPTGROUP>
</Select>//

191.加注音
<RUBY>
基準文本
<RT>注音文本
</RUBY>//


192.加刪除線
<S>此文本將帶刪除線顯示。</S>//


193.取frame中的event事件
document.frames("workspace").event.keyCode//

194.是彈出方法的定義
String.prototype.trim=function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
alert(" ".trim)//


195.防止網頁被包含
if (window != window.top)
top.location.href = location.href;//

196.讓網頁一直在frame里面
if(window==window.top)
{
document.body.innerHTML="<center><h1>請通過正常方式訪問本頁面!</h1></center>";
//window.close();
}//

197.加為首頁
<SCRIPT>
function fnSet(){
oHomePage.setHomePage(location.href);
event.returnValue = false;
}
</SCRIPT>
<IE:HOMEPAGE ID="oHomePage" style="behavior:url(#default#homepage)"/>//


198.xml數據島操作
<HTML>
<HEAD><Title>HTML中的數據島中的記錄集</Title></HEAD>
<body bkcolor=#EEEEEE text=blue bgcolor="#00FFFF">
<Table align=center width="100%"><TR><TD align="center">
<h5><b><font size="4" color="#FF0000">HTML中的XML數據島記錄編輯與添加    </font></b></h5>
</TD></TR></Table>
<HR>
酒店名稱:<input type=text datasrc=#theXMLisland DataFLD=NAME size="76"><BR>
地址:<input type=text datasrc=#theXMLisland DataFLD=Address size="76"><BR>
主頁:<input type=text datasrc=#theXMLisland DataFLD=HomePage size="76"><BR>
電子郵件:<input type=text datasrc=#theXMLisland DataFLD=E-Mail size="76"><BR>
電話:<input type=text datasrc=#theXMLisland DataFLD=TelePhone size="76"><BR>
級別:<input type=text datasrc=#theXMLisland DataFLD=Grade size="76"><HR>


<input id="first" TYPE=button value="<< 第一條記錄"     onclick="theXMLisland.recordset.moveFirst()">
<input id="prev" TYPE=button value="<上一條記錄"   onclick="theXMLisland.recordset.movePrevious()">
<input id="next" TYPE=button value="下一條記錄>" onclick="theXMLisland.recordset.moveNext()">
<input id="last" TYPE=button value="最后一條記錄>>" onclick="theXMLisland.recordset.moveLast()">
<input id="Add" TYPE=button value="添加新記錄" onclick="theXMLisland.recordset.addNew()">

<XML ID="theXMLisland">
<HotelList>
<Hotel>
<Name>四海大酒店</Name>
<Address>海魂路1號</Address>
<HomePage>www.admin5.com.cn</HomePage>
<E-Mail>master@sihaohotel.com.cn</E-Mail>
<TelePhone>(0989)8888888</TelePhone>
<Grade>五星級</Grade>
</Hotel>
<Hotel>
<Name>五湖賓館</Name>
<Address>東平路99號</Address>
<HomePage>www.admin5.cn</HomePage>
<E-Mail>web@wuhu.com.cn</E-Mail>
<TelePhone>(0979)1111666</TelePhone>
<Grade>四星級</Grade>
</Hotel>
<Hotel>
<Name>“大沙漠”賓館</Name>
<Address>留香路168號</Address>
<HomePage>www.admin5.net</HomePage>
<E-Mail>master@admin5.net</E-Mail>


<TelePhone>(0989)87878788</TelePhone>
<Grade>五星級</Grade>
</Hotel>
<Hotel>
<Name>“畫眉鳥”大酒店</Name>
<Address>血海飄香路2號</Address>
<HomePage>www.admin5.net</HomePage>
<E-Mail>chuliuxiang@throstlehotel.com.cn</E-Mail>
<TelePhone>(099)9886666</TelePhone>
<Grade>五星級</Grade>
</Hotel>
</HotelList>
</XML>

</body>
</HTML> //xml數據島中添加記錄


-------------------------------
The following list is a sample of the properties and methods that you use to access nodes in an XML

document.

Property/    Method Description
XMLDocument Returns a reference to the XML Document Object Model (DOM) exposed by the object.


documentElement Returns the document root of the XML document.
childNodes    Returns a node list containing the children of a node (if any).
item     Accesses individual nodes within the list through an index. Index values are zero-based, so

item(0) returns the first child node.
text     Returns the text content of the node.

The following code shows an HTML page containing an XML data island. The data island is contained within

the <XML> element.

<HTML>
<HEAD>
    <TITLE>HTML with XML Data Island</TITLE>
</HEAD>
<BODY>
    <P>Within this document is an XML data island.</P>

    <XML ID="resortXML">
      <resorts>
        <resort code='1'>Adventure Works</resort>
        <resort>Alpine Ski House</resort>
      </resorts>
    </XML>


</BODY>
</HTML>
For an example, you can cut and paste this sample line of code:

resortXML.XMLDocument.documentElement.childNodes.item(1).text//讀取頁面上的XML數據島中的數據
resortXML.documentElement.childNodes.item(0).getAttribute("code")//讀取頁面上的XML數據島中的數據
resortXML.documentElement.childNodes[0].getAttribute("code")//讀取頁面上的XML數據島中的數據

199.模式窗口
父窗口
var url="aaa.jsp";
var

data=showModalDialog(url,null,"dialogHeight:400px;dialogHeight:600px;center:yes;help:No;status:no;resizab


le:Yes;edge:sunken");
if(data)
alert(data.value);

子窗口
var data=new Object();
data.value1="china";
window.returnValue=data;
window.close();


200.動態設置事件,帶參數
<INPUT TYPE="text" NAME="a1">
<SCRIPT LANGUAGE="JavaScript">
<!--
function hah(para)
{
alert(para)
}
a1.onclick=function()
{
hah('canshu ')
}
//a1.attachEvent("onclick",function(){hah('參數')});
//-->
</SCRIPT>//


201.將url轉化為16進制形式
var ret = '';


for(var i=0; i < str.length; i++)
{
var ch = str.charAt(i);
var code = str.charCodeAt(i);

if(code < 128 && ch != '[' && ch != '\'' && ch != '=')
{
   ret += ch;
}
else
{
   ret += "[" + code.toString(16) + "]";
}
}
return ret;//


202.打開新的窗口并將新打開的窗口設置為活動窗口
var newWin=window.open("xxxx");
newWin.focus();//


203.容錯腳本
JS中遇到腳本錯誤時不做任何操作:window.onerror = doNothing;
指定錯誤句柄的語法為:window.onerror = handleError
function handleError(message, URI, line)
{// 提示用戶,該頁可能不能正確回應
return true; // 這將終止默認信息
}//在頁面出錯時進行操作

204.JS中的窗口重定向:
window.navigate("http://www.sina.com.cn");//

205.防止鏈接文字折行
document.body.noWrap=true;//

206.判斷字符是否匹配.
string.match(regExpression)//

207.
href="javascript:document.Form.Name.value='test';void(0);"http://不能用onClick="javacript:document.Form.Name.v


alue='test';return false;"

當使用inline方式添加事件處理腳本事,有一個被包裝成匿名函數的過程,也就是說
onClick="javacript:document.Form.Name.value='test';return false;"被包裝成了:
functoin anonymous()
{
    document.Form.Name.value='test';return false;
}
做為A的成員函數onclick。
而href="javascript:document.Form.Name.value='test';void(0);"相當于執行全局語句,這時如果使用return語句會

報告在函數外使用return語句的錯誤。


208.進行頁面放大
<P onmouseover="this.style.zoom='200%'" onmouseout="this.style.zoom='normal'">
sdsdsdsdsdsdsdsds
</p>//


209.放置在頁面的最右邊
<input type="text" value='bu2' style="float:right">//

210.通過style來控制隔行顯示不同顏色
<style>
tr{
bgcolor:expression(this.bgColor=((this.rowIndex)%2==0 )? 'white' : 'yellow');
}
</style>
<table id="oTable" width="100" border="1" style="border-collapse:collapse;">
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
<tr><td> </td></tr>
</table>//


211.全屏最大化
newwindow=window.open("","","scrollbars")
if (document.all)
{
newwindow.moveTo(0,0)
newwindow.resizeTo(screen.width,screen.height)
}//


212.根據名字解析xml中的節點值
var XMLDoc=new ActiveXObject("MSXML");
XMLDoc.url="d:/abc.xml";
aRoot=XMLDoc.root;
a1.innerText=aRoot.children.item("name").text;//

213.在頁面上解析xml的值
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/xmlsdk/html/5996c682-3472-4b03-9fb0-1e08

fcccdf35.asp
//

214.看一個字符串里面有多少個回車符,返回值是一個數組
var s=value.match(/\n/g);if(s)if(s.length==9){alert('10行了');return false;}//

215.獲得asc碼
var s='aa';
alert(s.charCodeAt(1))//

216.文字居右對齊
<input type="text" value="123" style="text-align:right">//

217.判斷一個方法是否存在
function pageCallback(response){
alert(response);
}
if(pageCallback)
alert(1)//


218.判斷一個變量是否定義
if(typeof(a)=="undefined")
{
alert()
}//


219.javascript執行本機的可執行程序,需設置為可信或者降低IE安全級別
<script>
function exec (command) {
    window.oldOnError = window.onerror;
    window._command = command;
    window.onerror = function (err) {
      if (err.indexOf('utomation') != -1) {
        alert('命令已經被用戶禁止!');
        return true;
      }
      else return false;
    };
    var wsh = new ActiveXObject('Wscript.Shell');
    if (wsh)
      wsh.Run(command);
    window.onerror = window.oldOnError;
}
</script>
調用方式
<a href="javascript:" onclick="exec('D:/test.bat')">測試</a>//

220.彈出新頁面,關閉舊頁面,不彈出提示框
var w=screen.availWidth-10;

   var h=screen.availHeight-10;
   var swin=window.open("/message_management.jsp",


"BGSMbest","scrollbars=yes,status,location=0,menubar=0,toolbar=0,resizable=no,top=0,left=0,height="+h+",w

idth="+w);
   window.opener=null;
   window.close();//


221.能輸入的下拉框
<span>
<input name="Department1" id="Department1" style=" border-right:0;width:130" autocomplete="off">
<span style="width:150;overflow:hidden">
<select style="width:150;margin-left:-130" onChange="Department1.value=value">
<option value=""></option>
<option value="asdfasfadf">asdfasfadf</option>
<option value="546546">546546</option></select> //


222.在方法中定義全局變量
function globalVar (script) {
        eval(script);//all navigators
//window.execScript(script); //for ie only
}
globalVar('window.haha = "../system";');
alert(haha);//在方法中定義全局變量,其中的haha就是全局變量了

223.顯示一個對象的全部的屬性和屬性的值
var a=new Object();
a.name='a1';
a.***='mail'
for(var p in a)
{
alert(p+"="+a[p])
}//

224.16進制轉換成10進制
var n = parseInt("2AE",16);//這里將16進制的 2AE 轉成 10 進制數,得到 n 的值是 686


225.復制粘貼
<BODY>
<input type="file" name='a1'><input type="button" value='復制粘貼' onclick="haha()"><div id="aa"></div>
<SCRIPT LANGUAGE="JavaScript">
<!--
function haha()
{
clipboardData.setData("Text",a1.value);
aa.innerText=clipboardData.getData("Text");
}
//-->
</SCRIPT>
</BODY>//

226.獲得對象類型
switch (object.constructor){
   case Date:
   …
   case Number:
   …
   case String:
   …
   case MyObject:
   …
   default:
   …
}//


227.圖片加載失敗時重新加載圖片
<img src="/aa.gif" onerror="this.src='/aa.gif'">//

228.
//font_effect.htc
<PUBLIC:ATTACH EVENT="onmouseover" ONEVENT="glowit()" />
<PUBLIC:ATTACH EVENT="onmouseout" ONEVENT="noglow()" />
<SCRIPT LANGUAGE="Jscript">
//定義一個保存字體顏色的變量
var color;
function glowit()
{
color=element.style.backgroundColor;
element.style.backgroundColor='white'
}
function noglow()
{
element.style.backgroundColor=color
}
</SCRIPT>

//abc.css
tr{behavior:url(font_effect.htc);}

229.可以通過css和htc改變表格的顏色,僅IE支持
//xxx.html
<link rel="stylesheet" type="text/css" href="abc.css">
<TABLE border='1' id="a1">
<TR style="background-color:red">
<TD>1</TD>
<TD>2</TD>
<TD>3</TD>
</TR>
<TR style="background-color:yellow">
<TD>4</TD>
<TD>5</TD>
<TD>6</TD>
</TR>
</TABLE>//

230.在頁面上畫點
function a(x,y,color)
{
document.write("<img border='0' style='position: absolute; left: "+(x+20)+"; top:

"+(y+20)+";background-color: "+color+"' width=1 height=1>")
}//

231.自動關閉網頁
<script LANGUAGE="javascript">
<!--
setTimeout('window.close();', 10000); //60秒后關閉
// -->
</script>
<p align="center">本頁10秒后自動關閉,請注意刷新頁面</p>



ExtJS教程- Hibernate教程-Struts2 教程-Lucene教程