锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲一级毛片免观看,亚洲午夜视频在线观看,人人狠狠综合久久亚洲高清http://m.tkk7.com/sonnylys/ 鐔熻兘鐢熷閥錛屽閥澶哄ぉ宸ワ紒
zh-cnSun, 06 Jul 2025 22:58:58 GMTSun, 06 Jul 2025 22:58:58 GMT60- 璇烽珮鎵嬭В鏁戝皬寮燂紝涓囧垎鎰熸縺錛佷嬌鐢╠om4j濡備綍瀹炵幇鎸塃lement鐨勬煇涓睘鎬ф帓搴忥紵錛燂紵http://m.tkk7.com/sonnylys/archive/2009/05/15/270844.htmlSonny LiSonny LiFri, 15 May 2009 06:47:00 GMThttp://m.tkk7.com/sonnylys/archive/2009/05/15/270844.htmlhttp://m.tkk7.com/sonnylys/comments/270844.htmlhttp://m.tkk7.com/sonnylys/archive/2009/05/15/270844.html#Feedback5http://m.tkk7.com/sonnylys/comments/commentRss/270844.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/270844.html璇烽珮鎵嬭В鏁戝皬寮燂紝涓囧垎鎰熸縺錛佷嬌鐢╠om4j濡備綍瀹炵幇鎸塃lement鐨勬煇涓睘鎬ф帓搴忥紵錛燂紵濡備笅闈ml鏂囦歡
<?xml version="1.0" encoding="GBK"?>
<books>
<book name="璇烽珮鎵嬭В鏁戜笅灝忓紵" price="30.00">
<book name="涓囧垎鎰熸縺" price="40.00">
<book name="璋㈣阿澶у鐨勫洖搴? price="50.00">
</books>
鎴戞兂鑾峰彇books鑺傜偣涓嬬殑鎵鏈塨ook瀛愯妭鐐癸紝騫舵寜price灞炴ф帓搴忥紝濡備綍瀹炵幇錛?br />
鏈漢闃呰dom4j鐨勬枃妗o紝鎵懼埌org.dom4j.xpath.DefaultXPath.selectNodes(Object context, XPath sortXPath)鏂規硶絎簩涓弬鏁?sortXPath"濂藉儚鏄敤鏉ユ帓搴忕殑錛屼絾涓嶇煡濡備綍鍐檚ortXPath鍙傛暟銆?br />
鍏堣阿榪囷紝鍦ㄧ嚎絳夈?br />
璇存槑錛氭湰浜轟笉闇瑕亁sl鎺掑簭鏂規銆?br />

]]> - 鑷紪 jtle(javascript template language engine) javascript妯℃澘璇█寮曟搸, 杞繪澗澶勭悊json鏁版嵁!http://m.tkk7.com/sonnylys/archive/2008/05/25/202677.htmlSonny LiSonny LiSun, 25 May 2008 02:24:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/05/25/202677.htmlhttp://m.tkk7.com/sonnylys/comments/202677.htmlhttp://m.tkk7.com/sonnylys/archive/2008/05/25/202677.html#Feedback4http://m.tkk7.com/sonnylys/comments/commentRss/202677.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/202677.html 闃呰鍏ㄦ枃

]]> - Prototype瀛︿範蹇?涔?bind鏂規硶鐨勨滆皽鈥濊糠浜鴻壊褰╋紒http://m.tkk7.com/sonnylys/archive/2008/05/08/199080.htmlSonny LiSonny LiThu, 08 May 2008 14:37:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/05/08/199080.htmlhttp://m.tkk7.com/sonnylys/comments/199080.htmlhttp://m.tkk7.com/sonnylys/archive/2008/05/08/199080.html#Feedback6http://m.tkk7.com/sonnylys/comments/commentRss/199080.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/199080.html Prototype鐨刡ind鏂規硶甯稿父鎶婅澶氬涔犲畠鐨勪漢寮勫緱緋婄硦娑傛秱錛実oogle鍜宐aidu涓鐣悗榪樻槸涓濉岃儭娑傦紒鏈漢涔熷姝わ紱鏈漢瑙夊緱瀹冩槸涓粠“璋滀漢”鍒?#8220;榪蜂漢”鐨勬柟娉曘傛鏂囧皢鍙戣〃涓漢瀵規鏂規硶鐨勭悊瑙o紝甯屾湜鑳藉府鍔╁ぇ瀹舵垚鍔熸浮“璋?#8221;錛屽埌杈?#8220;榪蜂漢”鐨勫郊宀革紒
<html>
<head>
<script src="prototype.js"></script> //@7
<script type="text/javascript">
/**********************************
*
* 瀹炵幇娓叉煋涓涓甫鏈?涓婁竴欏?鍜?涓嬩竴欏?鐨勭粍浠?鐐瑰嚮"涓婁竴欏?,褰撳墠欏靛噺1,鐐瑰嚮"涓嬩竴欏?褰撳墠欏靛姞1
*
*/
function PagesSystem(container){
this.currentPage = 10; //褰撳墠欏?br />
this.pageSysDiv = document.getElementById(container); //瀹瑰櫒
this.init = function() { //灝嗙粍浠剁敾鍑烘潵
this.createPrePage();
this.createNextPage();
};
this.changePage = function(evtObj) { //鏍規嵁鐐瑰嚮鍚庝紶榪囨潵鐨勫弬鏁板喅瀹氭槸鍔?鎴栨槸鍑?
if(evtObj == "next") {
this.currentPage += 1;
alert("浣犲凡鎵ц灝嗗綋鍓嶉〉鍔?錛岀幇鍦ㄥ綋鍓嶉〉鏄細" + this.currentPage);
}else if(evtObj == "pre"){
//姝ゅ涓嶄綔if(this.currentPage ==1) return;闄愬埗涓轟簡浣撶幇褰撲紶鍏ョ殑鍙傛暟涓?pre"鏃訛紝涓嬮潰鐨刟lert()涓瀹氫細鎵ц
this.currentPage -= 1;
alert("浣犲凡鎵ц灝嗗綋鍓嶉〉鍑?錛岀幇鍦ㄥ綋鍓嶉〉鏄細" + this.currentPage);
}
};
this.createPrePage = function() {//鍒涘緩涓婁竴欏電粍浠?br />
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:16px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.changePage; //@1 褰撶偣鍑繪錛?涓婁竴欏?錛夐摰閽椂鎵ц
_a.innerText = "涓婁竴欏?;
_span.appendChild(_a);
this.pageSysDiv.appendChild(_span);
};
this.createNextPage = function() {//鍒涘緩涓嬩竴欏電粍浠?br />
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:16px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.changePage; //@2 褰撶偣鍑繪錛?涓嬩竴欏?錛夐摰閽椂鎵ц
_a.innerText = "涓嬩竴欏?;
_span.appendChild(_a);
this.pageSysDiv.appendChild(_span);
};
this.init(); //鎵ц鍒濆鍖?br />
}
function testUse(msg){//@3鍦ㄦ彁鍑洪棶棰樼幆鑺傜敤鍒?br />
alert(msg);
}
window.onload = function() {
var ps = new PagesSystem("pageDiv");
}
</script>
</head>
<body>
<div id="pageDiv"></div>
</body>
</html>
浜屻佸垎鏋愪唬鐮侊紝鎻愬嚭闂錛岃В鍐抽棶棰?br />
1銆佹棤娉曚紶閫掑弬鏁伴棶棰樸?br />
浣犵粏鐪婡1鍜孈2澶?褰撳墠鐨勪唬鐮佸疄鐜版槸鏃犳硶鎶?pre"鍜?next"鍙傛暟浼犻掕繃鍘伙紝浜庢槸錛屽綋浣犺繍琛屼緥瀛愶紝鐐瑰嚮涓婁竴欏墊垨涓嬩竴欏碉紝閮芥槸娌′俊鎭痑lert鍑烘潵鐨勶紒
榪欑鎯呭喌錛屾槸寰堝父瑙佺殑銆傞偅涔堬紝濡備綍瀹炵幇灝嗗弬鏁頒紶榪囧幓銆?br />
灝咢1澶勪唬鐮佷慨鏀瑰涓嬶細
_a.onclick = function(){ //@1 褰撶偣鍑繪錛?涓婁竴欏?錛夐摰閽椂鎵ц
testUse("pre"); //鍙傜湅@3
this.changePage("pre");
}
榪欐牱鍒涘緩涓涓尶鍚嶅嚱鏁拌祴浜坃a.onclick,涔熷氨鏄綋_a瀵硅薄鐨刼nclick浜嬩歡瑙﹀彂鍚庡皢鎵ц姝ゅ尶鍚嶅嚱鏁幫紝鑰屽尶鍚嶅嚱鏁板皢甯繖璋冪敤testUse("pre")鍜宼his.changePage("pre")涓や釜鏂規硶錛?br />
浠庤岃揪鎴愪紶閫掑弬鏁般?br />
淇敼浠g爜錛岃繍琛屼緥瀛愬悗鐐瑰嚮涓婁竴欏靛悗浼氭樉紺哄涓嬩袱涓俊鎭紝涓涓槸testUse涓緭鍑虹殑淇℃伅錛岃瘉鏄庝簡瀹炵幇鍙傛暟浼犻掞紝鍙︿竴涓嵈鏄繍琛岄敊璇彁紺恒?br />

榪欐槸鎵цthis.changePage("pre")鏂規硶鎶涘嚭鏉ョ殑銆傚畠騫舵病鍍忔垜浠鏈熸兂鐨勮繍琛屻?br />
浠庢彁紺鴻幏鍒扮殑淇℃伅鏄紝瀵硅薄涓嶆敮鎸佹灞炴ф垨鏂規硶錛堝鏋滄祻瑙堝櫒鎶ョ殑鏄腑鏂囨彁紺哄氨鍙互鐪嬪埌“瀵硅薄涓嶆敮鎸佹鏂規硶鎴栧睘鎬?#8221;鐨勬彁紺猴級
鍥炲ご鐪媡his.changePage("pre")鏂規硶錛屽緢鏄庢樉this鏄敊璇彁紺轟腑鎵鎸囩殑瀵硅薄錛屽湪鏈簲鐢ㄤ腑鎸嘝agesSystem瀵硅薄鎸囬拡鐨勫紩鐢紝鍦ㄥ簲鐢ㄤ腑紜疄鏄0鏄庝簡this.changePage("pre")鏂規硶錛屼絾涓轟粈涔堣娌℃鏂規硶鍛紵錛燂紵錛?br />
2銆佸湪闂1涓紝鎴戜滑宸叉垚鍔熻В鍐充紶閫掑弬鏁幫紝浣哖agesSystem瀵硅薄鐨刢hangePage鏂規硶琚皝鍋蜂簡錛燂紵錛?br />
鍐嶅皢鍒氭墠鐨勪唬鐮佷慨鏀瑰:
_a.onclick = function(){ //@1 褰撶偣鍑繪錛?涓婁竴欏?錛夐摰閽椂鎵ц
testUse("pre"); //鍙傜湅@3
alert(this.tagName);
this.changePage("pre");
}
鍐嶈繍琛屼緥瀛愶紝浣犱細鍙戠幇杈撳嚭this.tagName鐨勫間負 A, 瀹冨氨鏄痏a瀵硅薄銆傚櫌錛屾垜鐨勫ぉ鍟娿傛庝箞浼氳繖鏍鳳紵錛燂紵
鍝堝搱..._a瀵硅薄灝辨槸<a href=""/></a>榪欎釜html 鍏冪礌瀵硅薄錛岃繖閲屾槸“涓婁竴欏?#8221;閾甸挳瀵硅薄錛屽師鍨嬩腑鍝潵changePage鏂規硶鍟婏紝鎵浠ユ姤閿欙紒錛侊紒
浣犲彲浠ヨ繖鏍風悊瑙o紝鐪嬪涓嬩唬鐮?
function PagesSystem(container){//姝ゅ簲鐢ㄤ腑鐨凱agesSystem瀵硅薄錛宑hangePage鏂規硶鐨勪笂涓嬫枃瀵硅薄,涔熷彲浠ョО涓哄綊灞炶呫?br />
//...鐪佺暐鍏跺畠浠g爜
this.changePage = function(evtObj) { //鏍規嵁鐐瑰嚮鍚庝紶榪囨潵鐨勫弬鏁板喅瀹氭槸鍔?鎴栨槸鍑?
if(evtObj == "next") {
this.currentPage += 1;
alert("浣犲凡鎵ц灝嗗綋鍓嶉〉鍔?錛岀幇鍦ㄥ綋鍓嶉〉鏄細" + this.currentPage);
}else if(evtObj == "pre"){
//姝ゅ涓嶄綔if(this.currentPage ==1) return;闄愬埗涓轟簡浣撶幇褰撲紶鍏ョ殑鍙傛暟涓?pre"鏃訛紝涓嬮潰鐨刟lert()涓瀹氫細鎵ц
this.currentPage -= 1;
alert("浣犲凡鎵ц灝嗗綋鍓嶉〉鍑?錛岀幇鍦ㄥ綋鍓嶉〉鏄細" + this.currentPage);
}
};
//...鐪佺暐鍏跺畠浠g爜
}
榪欐牱鐨勪唬鐮侊紝浣犲緢瀹規槗鐪嬪嚭this鏄寚PagesSystem, 閭d箞鎴戜滑緇х畫寰涓嬬湅
鍋囪 A瀵硅薄鐨勫師鍨嬪涓?
function A() {//@4
//...
this.onclick;
this.doClick = function() { //鐐瑰嚮
this.onclick();//鎵ц
}
//...
}
褰撲綘鍦≒agesSystem鏂規硶涓?br />
_a.onclick = function(){ //@1 褰撶偣鍑繪錛?涓婁竴欏?錛夐摰閽椂鎵ц
testUse("pre"); //鍙傜湅@3
alert(this.tagName);
this.changePage("pre");
}
鍐欎笂榪欐牱鐨勪唬鐮佸悗,浣犲彲浠ョ璋辮涓篅4鐨勪唬鐮佺殑妯℃牱鏄涓嬶細
function A() {//@4
//...
this.onclick = function(){ //@1 褰撶偣鍑繪錛?涓婁竴欏?錛夐摰閽椂鎵ц
testUse("pre"); //鍙傜湅@3
alert(this.tagName); //@5
this.changePage("pre"); //@6
};
this.doClick = function() { //鐐瑰嚮
this.onclick();//鎵ц
}
//...
}
鍛靛懙銆傘傚鏋滆繖鏍風湅鐨勮瘽錛孈5,@6涓殑this褰撶劧鏄寚a瀵硅薄錛屾病寮備箟銆傞偅褰撶劧鏄病changePage鏂規硶銆?br />
3銆侀偅涔堝浣曡В鍐寵繖闂鍛紵錛?br />
寰堝垢榪愶紝prototype.js涓殑bind鏂規硶灝卞彲浠ヨВ鍐寵繖鏍風殑闂錛屽畠榪樿В鍐蟲垜浠笂闈㈡彁鐨勪紶鍙傛暟闂銆?br />
鐪媌ind澶т緺甯呮牱:
bind: function() {
if (arguments.length < 2 && Object.isUndefined(arguments[0])) return this;
var __method = this, args = $A(arguments), object = args.shift();
return function() {
return __method.apply(object, args.concat($A(arguments)));
}
}
bind鏂規硶涓殑this灝辨槸bind鏂規硶鐨勬墍灞炶咃紙涓婁笅鏂囷級濡? f.bind(),f鏄竴涓0鏄庝簡鐨勬柟娉?閭d箞bind 鏂規硶閲岀殑this灝辨槸f
鍐嶇粏鐪嬶紝bind鏂規硶鍏跺疄鍋氱殑宸ヤ綔鏄繑鍥炰竴涓尶鍚嶅嚱鏁?姝ゅ尶鍚嶅嚱鏁板府蹇欐墽琛宼his鎵鎸囩殑鏂規硶錛坆ind鏂規硶鐨勬墍灞炶咃級錛屽鏋滀綘鏈夊涓嬩唬鐮?br />
function f(msg) {
this.functionName = "f method";
alert(msg);
alert(this.functionName);
}
button.onclick = f.bind(this, msg); //榪欓噷鐨則his鎸噁, 鍦╞ind鏂規硶涓敤object = args.shift()鑾峰緱錛岃繖鏍風殑璇濓紝褰撶偣鍑籦utton鍚庢墽琛宖鏂規硶, f鏂規硶涓殑this灝變笉浼氭棤鏁呰 button浠f浛銆俕_^涓嶇劧錛屼細鎶ラ敊鐨勫晩錛宐utton鍝潵functionName錛屽懙鍛?..
瀹冩棦瑙e喅灝唌sg鍙傛暟浼犺繃鍘伙紝鍚屾椂灝唂緇戝畾鍒癰utton鐜涓嬶紝bind鏂規硶寰楀悕鍙兘灝辨槸榪欐剰涔夊惂銆傝嚦浜庡浣曞疄鐜板皢f緇戝畾錛岄潬鐨勫氨鏄痑pply鏂規硶銆?br />
apply璋滀漢鑹插僵灝辯敱浣犱滑鑷鍘繪彮寮鍟︼紒
浠嬬粛浜哹ind澶т緺緇欏ぇ瀹訛紝鎴戠殑渚嬪瓙灝遍夯鐑︿綘浠嚜宸辮皟閫氬畠鍟︺傝阿浜嗐傘?br />
嬈㈣繋浜ゆ祦鎸囨銆?br />
澶囨敞錛?nbsp;濡傞渶杞澆鏈枃錛岃娉ㄦ槑鍑哄

]]>- 鐢╦avascript瀹炵幇杈冧負閫氱敤鐨勫鎴風鍒嗛〉緇勪歡http://m.tkk7.com/sonnylys/archive/2008/05/04/198279.htmlSonny LiSonny LiSun, 04 May 2008 14:54:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/05/04/198279.htmlhttp://m.tkk7.com/sonnylys/comments/198279.htmlhttp://m.tkk7.com/sonnylys/archive/2008/05/04/198279.html#Feedback23http://m.tkk7.com/sonnylys/comments/commentRss/198279.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/198279.html
<html>
<head>
<script src="pageSystem.js"></script>
<script>
var psys;
window.onload = function() {
psys = new PageSystem(1120, "pageDiv", 10, showMsg); //鎬昏褰曟暟, 鍒嗛〉緋葷粺瀹瑰櫒錛屾瘡緇?0欏?鍥炶皟
psys.init();
}
function showMsg(currentPage, pageSize) {
//鍥炶皟鏂規硶鑷畾涔夛紝涓や釜鍙傛暟錛岀涓涓負褰撳墠欏碉紝絎簩涓負姣忛〉璁板綍鏁?br />
/****************灝哻urrentPage鍜宲ageSize璇鋒眰鏁版嵁鏇存柊鍒楄〃,鏈濂戒嬌鐢╝jax鎶鏈?*****************/
alert("璇鋒眰鏁版嵁瑕佺殑鐩稿簲鍙傛暟>> currentPage: "+ currentPage + " pageSize: " + pageSize);
}
/*****濡傛灉瑕佹洿鏂板垎欏電郴緇熻濡備笅鎿嶄綔******/
//psys.update(count); //@count 涓鴻褰曟繪暟
function updatePageSys() {
psys.update(150); //@count 涓鴻褰曟繪暟
}
</script>
<style>
#pageDiv{
font-size:13px;
}
</style>
</head>
<body>
<div id="pageDiv">
</div>
<br/><br/>
<a href="#" onclick="updatePageSys();"/>鏇存柊鍒嗛〉緋葷粺</a>
</body>
</html>
2銆乸ageSystem.js
function PageSystem(count, divID, grountCount, callBack) {
this.totolCount = count; //鎬昏褰曟暟
this.initMaxPage = grountCount? grountCount: 5; //鏄劇ず欏墊暟錛屽 1 2 3 4 5
this.pageSize = 10; //姣忛〉璁板綍鏁?br />
this.currentMax = 0; //褰撳墠鏄劇ず鐨勬渶澶ч〉鐮? 濡?1 2 3 4 5; 5涓烘渶澶ч〉鐮?br />
this.currentMin = 0; //褰撳墠鏄劇ず鐨勬渶灝忛〉鐮? 濡?11 12 13 14 15; 11涓烘渶灝忛〉鐮?br />
this.homePage = 0; //棣栭〉
this.endPage = 0; //鏈〉
this.currentPage = 0; //褰撳墠欏?br />
this.currentActiveSpan; //褰撳墠媧誨姩a瀹瑰櫒
this.pageDivObj = document.getElementById(divID); //鍒嗛〉緋葷粺瀹瑰櫒
this.pages = 0; //鎬婚〉鏁幫紝璁$畻寰楀埌
//this._url = _url; //鎻愪氦URL
this.callBack = callBack; //鍥炶皟
var that = this; //鎸囬拡鐨勫紩鐢?br />
this.init = function() {
this.pages = parseInt(this.totolCount / this.pageSize); //鑾峰緱鎬誨叡鏈夊嚑欏?br />
this.pages = this.totolCount % this.pageSize == 0? this.pages: this.pages+1;
this.createHomePage();
this.createPrePage();
var n = 1;
while(n <= this.pages) {
if(n > this.initMaxPage){
break; //鍒拌揪鏈澶ф樉紺烘暟
}
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:10px";
if(n == 1) { //鍒濆鍖栨椂絎竴欏典負媧誨姩欏?br />
_span.innerText = n;
this.currentActiveSpan = _span;
}else{
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.reView;
_a.innerText = n;
_span.appendChild(_a);
}
this.pageDivObj.appendChild(_span);
n++;
}
if(this.pages != 0) {
this.currentMax = n - 1; //褰撳墠緇勬渶澶ч〉鐮?1 2 3 4 5鍊間負5
this.currentMin = 1; //褰撳墠鏈灝忛〉鐮?1 2 3 4 5 鍊間負1
this.homePage = 1; //棣栭〉
this.endPage = this.pages; //鏈〉
this.currentPage = 1; //褰撳墠欏?br />
}
//alert(this.currentMax);
//alert(this.currentMin);
this.createNextPage();
this.createEndPage();
};
this.query = function() {
var curPage = that.currentPage; //褰撳墠欏?br />
var pageSize = that.pageSize;
if(that.callBack) that.callBack(curPage, pageSize);
};
this.reView = function() {
//閲嶆柊娓叉煋UI
that.reViewActivePage();
that.query();
};
this.reViewActivePage = function() {
//閲嶆柊娓叉煋褰撳墠欏佃鍥?br />
var actA = event.srcElement; //褰撳墠琚偣鍑葷殑 a瀵硅薄
var ap = actA.parentNode; //鑾峰緱褰撳墠a瀹瑰櫒span瀵硅薄
//榪樺師褰撳墠欏佃鍥?br />
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.reView;
_a.innerText = that.currentActiveSpan.innerText;
that.currentActiveSpan.innerText = "";
that.currentActiveSpan.appendChild(_a);
//娓叉煋鏂扮殑褰撳墠欏佃鍥?br />
that.currentActiveSpan = ap; //鍒囨崲褰撳墠媧誨姩欏靛鍣?br />
var curPage = parseInt(actA.innerText);
that.currentActiveSpan.removeChild(actA);
that.currentActiveSpan.innerText = curPage;
this.currentPage = curPage; //鏇存敼褰撳墠欏電爜
if(!that.toNextGroup()) that.toPreGroup();
};
this.toNextGroup = function() {
//閲嶆柊娓叉煋鏄劇ず欏典笅涓緇?1 2 3 4 5 --> 5 6 7 8 9
if(that.currentPage == that.currentMax) {//鐐瑰嚮鐨勯〉鐮佷負褰撳墠緇勬渶澶ч〉鐮侊紝褰揼o 涓嬩竴緇?br />
if(that.currentPage != that.endPage) { //濡傛灉鐐逛簡鏈〉褰撶劧涓嶄細鍐嶆湁涓嬩竴緇勫暒錛?br />
that.pageDivObj.innerHTML = ""; //@1
var pageCode = parseInt(that.currentPage) + 1; //鏄劇ず欏電爜
var n = 2; //褰撳墠媧誨姩欏典笉閲嶅垱
this.createHomePage();
this.createPrePage();
that.currentActiveSpan.innerText = that.currentPage;
that.pageDivObj.appendChild(that.currentActiveSpan); //灝嗗綋鍓嶆椿鍔ㄩ〉鍥炴斁,璇風湅@1
while(pageCode <= that.pages) {
if(n > that.initMaxPage){
break; //鍒拌揪鏈澶ф樉紺烘暟
}
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:10px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = that.reView;
_a.innerText = pageCode;
_span.appendChild(_a);
that.pageDivObj.appendChild(_span);
pageCode++;
n++;
}
that.currentMax = pageCode - 1;
that.currentMin = that.currentPage;
// alert("currentMax: " + that.currentMax);
// alert("currentMin: " + that.currentMin);
this.createNextPage();
that.createEndPage();
return true;
}//end if
}//end if
return false;
};
this.toPreGroup = function() { //
//閲嶆柊娓叉煋鏄劇ず欏典笂涓緇?5 6 7 8 9 -->1 2 3 4 5
if(that.currentPage == that.currentMin) { //鐐逛簡緇勪腑鏈灝忛〉鐮?br />
if(that.currentPage != 1) {
that.pageDivObj.innerHTML = ""; //@2
var pageCode = parseInt(that.currentPage) - (that.initMaxPage -1); //鏄劇ず欏電爜
var n = 2; //褰撳墠媧誨姩欏典笉閲嶅垱
this.createHomePage();
this.createPrePage();
while(true) {
if(n > that.initMaxPage){
break; //鍒拌揪鏈澶ф樉紺烘暟
}
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:10px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = that.reView;
_a.innerText = pageCode++;
_span.appendChild(_a);
that.pageDivObj.appendChild(_span);
n++;
}
that.currentMax = that.currentPage;
that.currentMin = pageCode - (that.initMaxPage -1);
//alert("currentMax: " + that.currentMax);
// alert("currentMin" + that.currentMin);
that.currentActiveSpan.innerText = that.currentPage;
that.pageDivObj.appendChild(that.currentActiveSpan); //灝嗗綋鍓嶆椿鍔ㄩ〉鍥炴斁,璇風湅@2
that.createNextPage();
that.createEndPage();
}//end if
}//end if
};
this.toHomePage = function(){
//鍘誨埌棣栭〉
if(that.pages == 0) return;
if(that.currentPage != 1) {//鍒囩粍
that.pageDivObj.innerHTML = "";
that.init();
}//end if
that.currentPage = 1;
that.currentMin = 1;
that.currentMax = that.initMaxPage;
that.query();
};
this.toEndPage = function() {
//鍘誨埌鏈〉
if(that.pages == 0 ||that.currentPage == that.pages) return;
if(true) {//鍒囩粍鏉′歡淇敼錛屾鏉′歡浣滃簾,涓存椂璁句負true
that.pageDivObj.innerHTML = "";
that.createHomePage();
that.createPrePage();
var pageCode = 1;
var n = 1;
while(pageCode <= that.pages) {
if(n > that.initMaxPage-1){
n = 1;
}
n++;
pageCode++;
}
pageCode = that.pages - (n-2);
for(var j = 1; j < n; j++) {
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:10px";
if(pageCode == that.pages) { //鍒濆鍖栨椂絎竴欏典負媧誨姩欏?br />
_span.innerText = pageCode;
that.currentActiveSpan = _span;
}else{
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = that.reView;
_a.innerText = pageCode;
_span.appendChild(_a);
pageCode++;
}
that.pageDivObj.appendChild(_span);
}
that.createNextPage();
that.createEndPage();
}//end if
that.currentPage = that.pages;
that.currentMin = that.pages - (n-2);
that.currentMax = that.pages;
// alert("currentMin: " + that.currentMin);
//alert("currentMax: " + that.currentMax);
// alert("pages: " + that.pages);
that.query();
};
this.next = function() {
//涓嬩竴欏?br />
};
this.pre = function() {
//涓婁竴欏?br />
};
this.update = function(count) {
//鏇存柊鍒嗛〉緋葷粺
this.totolCount = count;
that.pageDivObj.innerHTML = "";
this.init();
};
this.createPrePage = function() {
return;
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:16px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.pre;
_a.innerText = "涓婁竴欏?;
_span.appendChild(_a);
this.pageDivObj.appendChild(_span);
};
this.createNextPage = function() {
return;
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:16px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.next;
_a.innerText = "涓嬩竴欏?;
_span.appendChild(_a);
this.pageDivObj.appendChild(_span);
};
this.createHomePage = function() {
var homeSpan = document.createElement("SPAN");
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.toHomePage;
_a.innerText = "棣栭〉";
homeSpan.appendChild(_a);
this.pageDivObj.appendChild(homeSpan);
};
this.createEndPage = function() {
var _span = document.createElement("SPAN");
_span.style.cssText = "margin-left:16px";
var _a = document.createElement("A");
_a.href = "#";
_a.onclick = this.toEndPage;
_a.innerText = "鏈〉(" + this.pages +")";
_span.appendChild(_a);
this.pageDivObj.appendChild(_span);
}
}
3銆佹晥鏋滃浘
濡傞渶杞澆錛岃娉ㄦ槑鍘熸枃鍑哄錛佽阿璋㈠悎浣溿?/span>

]]> - 鐢?window.showModalDialog()"瀹炵幇DIV妯″紡寮瑰嚭紿楀彛http://m.tkk7.com/sonnylys/archive/2008/05/01/197683.htmlSonny LiSonny LiThu, 01 May 2008 13:33:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/05/01/197683.htmlhttp://m.tkk7.com/sonnylys/comments/197683.htmlhttp://m.tkk7.com/sonnylys/archive/2008/05/01/197683.html#Feedback15http://m.tkk7.com/sonnylys/comments/commentRss/197683.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/197683.html
1銆乼est.html 嫻嬭瘯欏?/strong>
<html>
<head>
<title>嫻嬭瘯欏甸潰</title>
<style>
.list {
border-top:1 solid #8A2BE2;
border-left:1 solid #8A2BE2;
border-right:1 solid #8A2BE2;
}
.list td {
border-bottom: 1 solid #8A2BE2;
}
</style>
<script>
function $(el) {
return document.getElementById(el);
}
function showWin(param) {
window.showModalDialog("dailog.htm", param, "dialogWidth:" +param.width +"px;dialogHeight:"+param.height+"px;center:yes;help:no;scroll:no;status:no;resizable:no");
}
function TB(tbid) {
this.tb = typeof(tbid) == "string"? $(tbid): tbid;
this.getValue = function(rowIndex, cellIndex){
var trs = this.tb.rows[rowIndex];
var _td = trs.cells[cellIndex];
return _td.innerText;
}
this.setValue = function(rowIndex, cellIndex, value) {
var _tr = this.tb.rows[rowIndex];
var _td = _tr.cells[cellIndex];
_td.innerText = value;
}
/********鑾峰彇琛岀儲寮?*******/
this.findRowIndex = function(eventSrc) {
var _tr = eventSrc; //eventSrc浜嬩歡婧?蹇呴』鍦═D閲岃幏浜嬩歡婧愭槸TD鎴朤R鏈韓
while(_tr.tagName != "TR") {
_tr = _tr.parentNode;
}
var trs = this.tb.rows;
for(var i = 0; i < trs.length; i++){
if(_tr == trs[i]) return i;
}
}
}
function edit() {
var tb = new TB("data");
rIndex = tb.findRowIndex(event.srcElement);
$("updateRowIndex").value = rIndex;
$("userName").value = tb.getValue(rIndex, 1); //鑾峰緱濮撳悕
$("sex").value = tb.getValue(rIndex, 2); //鑾峰緱鎬у埆
$("age").value = tb.getValue(rIndex, 3); //鑾峰緱騫撮緞
showWin({title:"淇敼鐢ㄦ埛淇℃伅", width:390, height:230, _div:"openWin",parent:window});
}
function saveAndUpdateView(){
var updateRowIndex = $("updateRowIndex").value;
var tb = new TB($f("data")); //$f()鍦╠ailog.html瀹氫箟,鑾峰埌鐨則able鏄埗紿楀彛涓殑table
tb.setValue(updateRowIndex, 1, $("userName").value);
tb.setValue(updateRowIndex, 2, $("sex").value);
tb.setValue(updateRowIndex, 3, $("age").value);
close();
}
</script>
</head>
<body>
<p style="margin-top:60px">
<center>
<table id="data" class="list" width="460px">
<tr>
<td>緙栧彿</td>
<td>鐢ㄦ埛鍚?lt;/td>
<td>鎬у埆</td>
<td>騫撮緞</td>
<td>鎿嶄綔</td>
</tr>
<tr>
<td>1</td>
<td>鏉庢案鑳?lt;/td>
<td>鐢?lt;/td>
<td>27</td>
<td><span style="background:#FAEBD7;cursor:hand" onclick="edit();"> 淇敼 </span></td>
</tr>
<tr>
<td>2</td>
<td>鏋楀厔</td>
<td>鐢?lt;/td>
<td>27</td>
<td><span style="background:#FAEBD7;cursor:hand" onclick="edit();"> 淇敼 </span></td>
</tr>
<tr>
<td>3</td>
<td>鍙跺厔</td>
<td>鐢?lt;/td>
<td>23</td>
<td><span style="background:#FAEBD7;cursor:hand" onclick="edit();"> 淇敼 </span></td>
</tr>
</table>
</center>
</p>
<!---寮瑰嚭紿楀彛鏄劇ず鐨勫唴瀹?--->
<div id="openWin" style="display:none;">
<form>
<fieldSet>
<legend>淇敼鐢ㄦ埛</legend>
<table>
<tr>
<td>鐢ㄦ埛鍚?lt;/td><td><input type="text" id="userName"/></td>
</tr>
<tr>
<td>鎬у埆</td><td><input type="text" id="sex"/></td>
</tr>
<tr>
<td>騫撮緞</td><td><input type="text" id="age"/></td>
</tr>
</table>
</fieldSet>
<input type="hidden" id="updateRowIndex"/>
</form>
<span style="background:#FAEBD7;cursor:hand" onclick="saveAndUpdateView();"> 淇敼 </span>
</div>
</body>
</html>
2銆乨ailog.html 紿楀彛鍘熷瀷
<html>
<head>
<script>
var param = window.dialogArguments; //浼犺繃鏉ョ殑妯″紡瀵硅瘽妗嗙獥鍙e弬鏁?br />
document.title = param.title; //紿楀彛鏍囬,蹇呴』鍦ㄧ獥鍙e垱寤哄墠瀹炵幇s
/********灝嗙埗紿楀彛鐨刯s鍔犺澆榪涙潵********/
var scripts = param.parent.document.scripts;
var _head = document.getElementsByTagName("head")[0];
for(var n = 0; n < scripts.length; n++) {
if(scripts[n].src) {
var _script = newEl("script");
_script.src = scripts[n].src;
bind(_head, _script);
}else{//鍔犺澆鐩存帴鍦╤tml鏂囨。涓啓鐨剆cript
var _script = newEl("script");
_script.text = scripts[n].text;
bind(_head, _script);
}
}
/*******鏍規嵁ID鑾峰緱鐖剁獥鍙g殑鍏冪礌*********/
function $f(el) {
return param.parent.document.getElementById(el);
}
/***********鍒涘緩涓涓狧TML鍏冪礌*******/
function newEl(tagName) {
return document.createElement(tagName);
}
/***********榪藉姞鍏冪礌***************/
function bind(ower, child) {
ower.appendChild(child);
}
/*******鍦ㄦ祻瑙堝櫒瀹屾垚瀵硅薄鐨勮杞藉悗绔嬪嵆瑙﹀彂*********/
window.onload = function() {
var winDiv;
if(typeof(param._div) == "string") {
winDiv = param.parent.document.getElementById(param._div); //鐖剁獥鍙indow瀵硅薄,鍥犱負param._div瀵硅薄鍦ㄧ埗紿楀彛
}else{//鐩存帴浼犲璞¤繃鏉?br />
winDiv = param._div;
}
$("mainDiv").innerHTML = winDiv.innerHTML; //灝咲IV鍐呭鍦ㄥ脊鍑虹獥鍙d腑娓叉煋
}
</script>
</head>
<body>
<center>
<div id="mainDiv" style="margin-top:20px;width:90%"></div>
</center>
</body>
</html>
濡傞渶杞澆錛岃娉ㄦ槑鍘熸枃鍑哄錛佽阿璋㈠悎浣溿?/span>

]]> - 鐢ㄦā寮忓璇濇瀹炵幇鈥滄秷鎭彁紺烘鈥濆拰鈥滄搷浣滄彁紺烘鈥?/title>http://m.tkk7.com/sonnylys/archive/2008/05/01/197655.htmlSonny LiSonny LiThu, 01 May 2008 07:54:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/05/01/197655.htmlhttp://m.tkk7.com/sonnylys/comments/197655.htmlhttp://m.tkk7.com/sonnylys/archive/2008/05/01/197655.html#Feedback2http://m.tkk7.com/sonnylys/comments/commentRss/197655.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/197655.html
鐢變簬鏈漢璁や負鐢?alert()鍜宑onfirm()鐨勬秷鎭鍜屾搷浣滅‘璁ゅ璇濇錛岀晫闈笉澶弸濂斤紝涓嬮潰浠嬬粛鐢ㄦā寮忓璇濇瀹炵幇“娑堟伅鎻愮ず 妗?#8221;鍜?#8220;鎿嶄綔鎻愮ず妗?#8221;錛涚敤妯″紡瀵硅瘽妗嗕篃鍙互瀹炵幇寮瑰嚭紿楀彛(鎶辨嫭Iframe妯″紡鍙奃IV妯″紡錛夛紝DIV妯″紡杈冮夯鐑︿簺錛屼笉榪囷紝榪樻尯瀹炵敤錛岃繖閲屼笉浣滀粙緇嶃?
1銆乼est.html 嫻嬭瘯欏?/strong>
<html>
<head>
<title>嫻嬭瘯欏甸潰</title>
<script>
/**** 鎵撳紑娑堟伅妗?***
* @param 涓篛bject綾誨瀷,鍘熷瀷涓?{msg:"val1", time:val2},val1涓鴻鎻愮ず鐨勬秷鎭紝val2涓虹獥鍙e嚭鏉ュ悗寤惰繜鍏抽棴鐨勬椂闂?
*
*/
function showMsg(param) {
window.showModalDialog("msg.html", param, "dialogWidth:280px;dialogHeight:180px;center:yes;help:no;scroll:no;status:no;resizable:no");
}
/****鎿嶄綔紜紿楀彛*****
* @param 涓簊tring綾誨瀷,鎻愮ず淇℃伅
* @return true涓洪夊彇浜?#8220;紜畾”閾甸挳錛宖alse涓洪夊彇浜?#8220;鍙栨秷”閾甸挳
*/
function confirm(msg) {
return window.showModalDialog("confirm.html", msg, "dialogWidth:280px;dialogHeight:180px;center:yes;help:no;scroll:no;status:no;resizable:no");
}
function confirmDel() {
var rval = confirm("紜畾鍒犻櫎姝ょ敤鎴峰悧錛?);
if(rval) {
showMsg({msg:"浣犵偣鍑諱簡紜畾閾甸挳", time:1200});
}else{
showMsg({msg:"浣犵偣鍑諱簡鍙栨秷閾甸挳", time:1200});
}
}
</script>
</head>
<body>
<center>
<a href="#" onclick="showMsg({msg:'1縐掗挓鍚庝細鑷姩鍏抽棴鐨勬彁紺轟俊鎭', time:1000})">浼氳嚜鍔ㄥ叧闂殑鎻愮ず淇℃伅妗?lt;/a>
<br/>
<a href="#" onclick="confirmDel();">鎿嶄綔紜瀵硅瘽妗?lt;/a>
</center>
</body>
</html>
2銆乵sg.html 娑堟伅妗嗛氱敤妯℃澘
<html>
<head>
<title>鎻愮ず瀵硅瘽妗?lt;/title>
<script>
var obj = window.dialogArguments; //浼犺繃鏉ョ殑妯″紡瀵硅瘽妗嗙獥鍙e弬鏁?br />
/****鍦╫bj.time縐掑悗鍏抽棴紿?***/
window.setTimeout(function() {
window.close();
}, obj.time);
</script>
</head>
<body>
<p style="margin-top:36px">
<center>
<script>
document.write(obj.msg); //鎵撳嵃淇℃伅
</script>
</center>
</p>
</body>
</html>
3銆乧onfirm.html
<html>
<head>
<title>鎿嶄綔紜瀵硅瘽妗?lt;/title>
<script>
function setState() {
returnValue = event.srcElement.id == "ok"? true: false;
window.close();
}
</script>
</head>
<body>
<p style="margin-top:26px">
<center>
<script>
var msg = window.dialogArguments? window.dialogArguments: "";
document.write(msg);
</script>
<br/>
<div style="margin-top:20px">
<a href="#" id="ok" onclick="setState()">紜畾</a>
<a href="#" id="cal" onclick="setState()">鍙栨秷</a>
</div>
</center>
</p>
</body>
</html>
榪愯test.html渚嬪瓙鍙互鐪嬪埌鐩稿簲鐨勬晥鏋?br />


]]> - 綆鍗曠殑javascript鍏ラ棬鐭ヨ瘑http://m.tkk7.com/sonnylys/archive/2008/04/27/196669.htmlSonny LiSonny LiSun, 27 Apr 2008 14:53:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/04/27/196669.htmlhttp://m.tkk7.com/sonnylys/comments/196669.htmlhttp://m.tkk7.com/sonnylys/archive/2008/04/27/196669.html#Feedback2http://m.tkk7.com/sonnylys/comments/commentRss/196669.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/196669.html
涓涓?JavaScript 紼嬪簭鍏跺疄鏄竴涓枃妗o紝涓涓枃鏈枃浠訛紝瀹冨祵鍏ュ埌 HTML 鏂囨。涓墽琛屻傛墍浠ワ紝涓鑸殑鏈枃緙栬緫鍣ㄥ氨鍙互瀹炵幇緙栧啓javascript浠g爜銆?br />
1銆佸皢javascript宓屽叆鍒癏TML鏂囨。涓紝涓鑸湁涓ょ瀹炵幇鏂規硶銆備竴縐嶆槸鐩存帴鍦℉TML鏂囨。涓殑浠諱綍鍦版柟鍔犲叆<script>
<!--浣犵殑js浠g爜-->
</script>
鍊煎緱娉ㄦ剰鐨勬槸錛宩s浠g爜蹇呴』鍦?lt;frameset>涔嬪墠鎻掑叆鎵嶆湁鏁堛?br />
鍙︿竴縐嶆槸灝唈s浠g爜鍐欏湪涓涓互 .js涓哄悗緙鐨刯s鏂囦歡閲岋紝鐢ㄤ互涓嬫柟娉曞紩鍏ュ埌HMTL妗d緵浣跨敤
<script src="浣犺寮曞叆鐨?js鏂囦歡鐨勮礬寰? type="text/javascript"></script>
榪欎袱縐嶅疄鐜扮殑渚嬪瓙濡備笅錛?br />
<html>
<head>
<title>js exmaple</title>
<!--鐩存帴鍦℉MTL鏂囨。涓啓js浠g爜-->
<script>
function sayHello() {
alert("hello");
}
</script>
<!--浠?js鏂囦歡涓姞杞?->
<script src="myjs/util.js"></script>
</head>
<body>
</body>
</html>
2銆佸彉閲忓0鏄?br />
javascript涓敤 var鍏抽敭瀛楀0鏄庝竴涓彉閲忥紝濡傦細var userName;鐢變簬javascript浣跨敤鐨勬槸寮辯被鍨嬶紝鎵浠ュ0鏄庢椂涓嶉渶瑕佹寚瀹氬叿浣撶被鍨嬶紝鍦ㄨ繍琛屾椂浼氭牴鎹墍璧嬬殑鍊兼鏌ュ叾鏁版嵁綾誨瀷銆傛瘮濡傚0鏄?var v; 鍦ㄨ繍琛屼腑濡傛灉鍑虹幇v = 123;閭d箞鍙橀噺v鎸囨暟鍊肩被鍨嬶紝濡傛灉榪愯涓嚭鐜扮殑鏄痸 = "123"錛寁 涓哄瓧絎︿覆綾誨瀷銆?br />
3銆佸嚱鏁板0鏄庯紝浠嬬粛涓ょ鍨嬪紡
涓銆乫unction sayHello(who) { //who涓哄弬鏁?br />
alert("say hello to: " + who);
}
浜屻乿ar sayHello = function(who) {
alert("say hello to: " + who);
}
璇存槑錛氱浜岀澹版槑鏂瑰紡鏄皢鍑芥暟鐨勬寚閽堣祴緇欎竴涓彉閲忥紝璋冪敤濡備笅錛歴ayHello("whoOne");鍜岀涓縐嶅0鏄庢柟寮忚皟鐢ㄤ竴鏍楓備婦涓浜岀澹版槑鏂瑰紡鏈夌敤鐨勫簲鐢紝濡傦紝鍦╦s浠g爜涓紝緇欎竴涓摰閽殑onclick浜嬩歡娉ㄥ唽涓涓柟娉曞彲浠ュ涓嬪0鏄庯細 var btn = document.createElement("button");
btn.onclick= function() {
//娣誨姞褰撶偣鍑繪閾甸挳鏃舵兂鎵ц鐨刯s浠g爜
}
4銆佷簨浠跺搷搴?br />
澹版槑浜嗙殑鍑芥暟鍙互鍦╦s浠g爜閲岃璋冪敤錛屼篃鍙互鐢ㄤ簬鍝嶅簲浜嬩歡銆傚錛?br />
<html>
<head>
<title>js exmaple</title>
<!--鐩存帴鍦℉MTL鏂囨。涓啓js浠g爜-->
<script>
function sayHello() {
alert("hello");
}
</script>
</head>
<body>
<!--鍝嶅簲button涓殑onclick浜嬩歡錛堝崟鍑諱簨浠訛級,璋冪敤sayHello()鏂規硶-->
<button onclick="sayHello()">鐐瑰嚮灝嗚皟鐢╯ayHello()鏂規硶鏉ュ搷搴?lt;/button>
</body>
</html>
榪愯渚嬪瓙錛岀偣鍑婚摰閽悗榪愯緇撴灉濡備笅錛?br />

澶囨敞錛氳繖鏄竴綃囧緢綆鍗曠殑javascript鐩稿叧鐭ヨ瘑鏂囩珷錛岄傚悎瀵筳avascript瀹屽叏娌℃蹇電殑鍒濆鑰呭弬鑰冿紝 鏈夎涔嬪錛岃鎸囨璁ㄨ銆?br />

]]> - Spring涓嶴truts闆嗘垚寮鍙?/title>http://m.tkk7.com/sonnylys/archive/2008/03/01/183112.htmlSonny LiSonny LiSat, 01 Mar 2008 03:08:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/03/01/183112.htmlhttp://m.tkk7.com/sonnylys/comments/183112.htmlhttp://m.tkk7.com/sonnylys/archive/2008/03/01/183112.html#Feedback2http://m.tkk7.com/sonnylys/comments/commentRss/183112.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/183112.html
Spring涓嶴truts闆嗘垚寮鍙?br />
鏈榪戝枩嬈㈠皢鎵瀛︾殑涓滆タ鐞嗛『涓涓嬶紝涓斿彂鐜板啓blog鍙互杈炬垚榪欑洰鐨勩?br />
閭e氨鏉ユ暣鐞嗕竴涓嬫垜瀵筍pring涓嶴truts闆嗘垚寮鍙戠殑涓浜涙兂娉曘?br />
棣栧厛紜緋葷粺鐨勭粨鏋勪負涓夊眰鐨凚/S妯″紡緇撴瀯錛屽涓嬪浘錛?br />

鍦ㄥ浘涓湅鍑猴紝Spring鍜孲truts闆嗘垚寮鍙戜腑錛孲pring鍦ㄤ笟鍔¢昏緫灞傝浣跨敤錛堥泦鎴愶級銆傚洜涓篠pring妗嗘灦鐨勪緷璧栨敞鍏ワ紝AOP鍙婂彲澹版槑鐨勪簨鍔$鐞嗘柟闈㈢殑鎶鏈紭鍔匡紝浣垮緱鐢⊿pring鏉ョ鐞嗕笟鍔″疄浣擄紝瀹炰綋涔嬮棿鐨勪緷璧栧叧緋伙紝涓氬姟閫昏緫鏈嶅姟鎺ュ彛鍙樺緱綆鍗曚笖鍙厤緗傝嚦姝ゆ垜浠娓呮錛?span style="color: red">Spring鍜孲truts闆嗘垚寮鍙戜腑錛孲pring鍦ㄤ笟鍔¢昏緫灞傝浣跨敤錛堥泦鎴愶級銆?/span>
娓呮Struts鍜孲pring鍦ㄧ郴緇熺粨鏋勪腑鍒嗗埆鍏呭綋鐨勮鑹插悗錛屾帴涓嬫潵瑕佽璁猴細濡備綍瀹炵幇闆嗘垚錛?br />
1銆佷嬌鐢⊿pring鐨凙ctionSurpert綾婚泦鎴怱truts銆?/strong>
org.springframework.web.struts.ActionSurpert鏄竴涓戶鎵縪rg.apache.struts.action.Action鐨勭被錛岀畝瑕佷唬鐮佸涓嬶細
public abstract class ActionSurpert extends Action {
private WebApplicationContext webApplicationContext;
public void setServlet(ActionServlet actionServlet) {//褰撳鍣ㄥ疄渚嬪寲姝ction鏃惰瀹瑰櫒璋冪敤
surper.setServlet(actionServlet);
if(actionServlet != null) {
this.webApplicationContext = initWebApplicationContext(actionServlet);//鑾峰彇webApplicationContext
//........
}else{
//.......
}
}
//閫氳繃getXXX()鏂規硶鑾峰彇 webApplicationContext 瀵硅薄
protected final WebApplictionContext getWebApplicationContext() {
return this.webApplicationContext;
}
}
閫氳繃涓婅堪浠g爜鍙互鐪嬪嚭錛屾墍鏈夌戶鎵夸簡ActionSupport綾葷殑Action灝嗗彲浠ラ氳繃WebApplicationContext瀵硅薄鐨刧etBean(beanKey)鏂規硶鑾峰緱Spring閰嶇疆鏂囦歡涓畾涔夌殑鍚勭Bean銆?br />
WebApplicationContext瑕佺敱Web Server鏉ュ姞杞斤紝鏈変袱縐嶆柟娉曪細
錛戙侀氳繃org.springframework.web.struts.ContextLoaderPlugIn鍔犺澆錛孋ontextLoaderPlugIn鏄釜鎻掍歡錛岄渶瑕佸湪Struts閰嶇疆鏂囦歡涓厤緗?br />
<plug-in className="org.springframework.web.struts.ContextLoaderPlugIn">
<set-property property = "contextConfigLocation" value="/WEB-INF/applicationContext.xml"></set-property>
</plug-in>
2銆佸湪web.xml鏂囦歡涓姞杞?br />
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-name>
<load-on-startup>1</load-on-startup>
</servlet>
涓句釜綆鍗曠殑渚嬪瓙璇存槑涓涓嬬浉鍏抽厤緗俊鎭細
鍋囧畾鏈塃xampleAction錛孍xampleBean錛孍xampleService榪欏嚑涓被錛屽畠浠伐浣滄祦紼嬫槸錛?br />
鐢ㄦ埛璇鋒眰ExampleAction錛孍xampleAction璋冪敤ExampleService鐨勬帴鍙f柟娉曞ExampleBean榪涜鐩稿叧鐨勬搷浣溿?br />
1銆乤pplicationContext.xml涓厤緗浉鍏崇殑bean淇℃伅
<beans>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>com.mysql.jdbc.Driver</value>
</property>
<property name="url">
<value>jdbc:mysql://localhost:3306/ssh?useUnicode=true&characterEncoding=UTF-8</value>
</property>
<property name="username">
<value>root</value>
</property>
<property name="password">
<value>root</value>
</property>
</bean>
<bean id="exampleBean" class="org.mypackge.beans.ExampleBean"/>
<bean id="exampleBeanService" class="org.mypackge.services.ExampleService"/>@
</beans>
閫氳繃榪欐牱閰嶇疆鍚庯紝鍦‥xampleAction涓彲浠ョ敤getWebApplicationContext() 鑾峰緱webApplicationContext瀵硅薄錛岀劧鍚庨氳繃
webApplicationContext鐨刧etBean(beanKey)鏂規硶鑾峰緱鐩稿簲鐨刡ean榪涜涓氬姟澶勭悊銆傛爣浜嗙孩鑹茬殑"beanKey"灝辨槸applicationContext.xml涓?lt;bean>鍏冪礌瀹氫箟鐨刡ean id錛屽:webApplicationContext.getBean("exampleBeanService")銆侤
褰撶劧錛孍xampleAction榪樿鍦╯tuts-config.xml閰嶇疆鏂囦歡涓厤緗紝榪欓噷涓嶄綔浠嬬粛銆?br />
2銆佷嬌鐢⊿pring鐨凙ction浠g悊闆嗘垚Struts
榪欑闆嗘垚鏂瑰紡鐨勬牳蹇冩濇兂鏄紝灝哠truts鐨勯厤緗枃浠朵腑鐨勬墍鏈堿ction鐨則ype灞炴ц涓簅rg.springframwork.web.struts.DelegationActionProxy銆傚綋鐢ㄦ埛璇鋒眰Action鏃訛紝灝辨墽琛岃繖浠g悊錛屼唬鐞嗕細鍦⊿pring搴旂敤涓婁笅鏂囦腑鎵懼埌鐪熸鐨凙ction錛岀劧鍚庝氦緇欏畠澶勭悊鐢ㄦ埛鐨勮姹傘傝岀湡姝g敤浜庡鐞嗙敤鎴瘋姹傜殑Action鐨勯厤緗斁鍦ㄤ簡Spring鐨勯厤緗枃浠朵腑銆傝繖鏍鳳紝Struts涓殑Action浠ュ強鍏朵緷璧栧叧緋誨氨鍙互鐢⊿pring瀹瑰櫒鏉ョ鐞嗭紝姣斿灝嗕笟鍔¢昏緫瀵硅薄娉ㄥ叆鍒癆ction涓紝渚涘叾浣跨敤銆傜畝鍗曠墖孌?lt;bean name="/exampleAction" class="org.myproj.struts.actions.ExampleAction">
....
</bean>
璇存槑錛氱敤name灞炴ц屼笉鏄敤id鏉ユ爣璇嗚繖涓狟ean,Spring涓嶅厑璁窱D涓嚭鐜?/"錛岃宯ame鍙互錛?name"灞炴у艱鍜宻truts-config.xml鏂囦歡涓浉搴?lt;action>鍏冪礌涓殑path灞炴у肩浉鍚?span style="color: #ff99cc">(<action path="/exampleAction")錛岃繖鏍稟ction浠g悊鎵嶈兘鎵懼埌鐩稿簲鐨凙ction鏉ュ鐞嗚姹傘?br />
嬈㈣繋璁ㄨ錛屾彁鍑哄疂璐墊剰瑙併?br />

]]> - struts涓巋ibernate闆嗘垚寮鍙?/title>http://m.tkk7.com/sonnylys/archive/2008/02/29/183017.htmlSonny LiSonny LiFri, 29 Feb 2008 10:44:00 GMThttp://m.tkk7.com/sonnylys/archive/2008/02/29/183017.htmlhttp://m.tkk7.com/sonnylys/comments/183017.htmlhttp://m.tkk7.com/sonnylys/archive/2008/02/29/183017.html#Feedback0http://m.tkk7.com/sonnylys/comments/commentRss/183017.htmlhttp://m.tkk7.com/sonnylys/services/trackbacks/183017.html
鏈榪戝涔爏truts涓巋ibernate鐩稿叧鐭ヨ瘑錛屼笅闈㈡槸涓漢瀵箂truts涓巋ibernate闆嗘垚寮鍙戠殑涓浜涜瑙o紝鍐欏嚭鏉ヨ窡澶у鍏卞悓璁ㄨ銆佸涔狅紝嬈㈣繋鎸囨暀銆?br />
瑕侀泦鎴恠truts涓巋ibernate榪涜寮鍙戯紝棣栧厛搴旇浜嗚В涓涓媠truts鍜宧ibernate妗嗘灦鍚勮嚜鐨勫伐浣滃師鐞嗗拰妯″紡鑸殑寮鍙戞祦紼嬨?br />
棣栧厛浠嬬粛struts鐨勫ぇ姒傚伐浣滄祦紼嬶紝涓嬮潰閫氳繃涓寮爏truts宸ヤ綔鐨勬椂搴忓浘鏉ヨ鏄庡叾宸ヤ綔嫻佺▼錛?br />

Struts宸ヤ綔嫻佺▼鍒嗘瀽錛?br />
1錛塛eb鏈嶅姟鍣ㄥ惎鍔紝鍒濆鍖朅ctionServlet,璇誨彇struts-config.xml鏂囦歡閰嶇疆淇℃伅錛屾妸榪欎簺淇℃伅鍒嗗彂鍒扮浉搴旂殑瀵硅薄涓?br />
2錛夌敤鎴峰彂鍑鴻姹傚悗錛孉ctionServlet鎺ユ敹鍒拌姹傦紝鏌ユ壘涓庤姹傚尮閰嶇殑Action鏄犲皠瀵硅薄錛圓ctionMapping)瀵硅薄鏄惁瀛樺湪錛屾槸錛氬皢璇鋒眰浠ュ強Actionform瀵硅薄浼犻掔粰鐩稿簲鐨凙ction瀵硅薄銆?br />
3錛堿ction璋冪敤涓氬姟閫昏緫鏈嶅姟鎺ュ彛錛岀粨鍚圓ctionForm錛屽鐢ㄦ埛鐨勮姹傚仛鍑哄鐞嗐?/strong>
4錛堿ction澶勭悊瀹屾瘯榪斿洖ActionForward瀵硅薄緇橝ctionServlet銆侫ctionForward瀵硅薄鍖呭惈浜嗚漿鍙戠洰鏍囧璞★紝鍙互鏄痡sp鎴朅ction銆?br />
5)ActionServlet鏍規嵁ActionForward瀵硅薄鐨勬寚鍚戠戶緇漿鍙戣姹傦紝閲嶅浠庣2姝ヨ繘琛屽鐞嗐?br />
鑷蟲錛屾垜浠struts 鐨勫熀鏈伐浣滄祦紼嬫湁涓暣浣撶殑璁よ瘑錛屼絾榪樻病鎻恏ibernate鐩稿叧鐨勪換浣曠煡璇嗭紝涓氬姟閫昏緫灞備篃鍙槸鍦ㄧ3)鐐瑰井鎻愪竴涓嬨?br />
鎺ヤ笅鏉ワ紝鎴戜滑鏉ョ湅涓媓ibernate鏄庢牱宸ヤ綔鐨勶紵(娉細鍦ㄨ繖涓嶆槸璁ㄨ錛疾錛殑瀹炵幇錛屽彧璁ㄨ鎬庤hibernate榪橭RM涓棿浠跺伐浣滐級
Hibernate鏄釜鐙珛鐨勬鏋訛紝瀹冧笉渚濊禆浠諱綍鐨刉eb Server鎴朅pplication Server錛屽氨鏄涓嶉渶瑕佽繖浜涙敮鎸併?br />
Hibernate鏈変簲涓牳蹇冩帴鍙o紝鍒嗗埆涓篊onfiguratoin, SessionFactory, Session,Query鍙奀riteria銆傞氳繃榪欎簺鎺ュ彛灝卞彲浠ュ畬鎴恏ibernate鐨勫垵濮嬪寲錛屽鎸佷箙鍖栧璞¤繘琛屽瓨鍙栵紝鏇存柊絳夋搷浣溿?br />
涓嬮潰綆瑕佷粙濮嬩竴涓嬭繖浜涙帴鍙c?br />
1銆丆onfiguration鎺ュ彛 鏄疕ibernate搴旂敤鐨勫叆鍙o紝鍦ㄥ紑濮嬩嬌鐢℉ibernate鐨勫悇縐嶅姛鑳戒箣鍓嶉渶瑕佸厛鍒涘緩Configuration瀵硅薄銆傚畠璐熻矗鍔犺澆Hibernate 搴旂敤閰嶇疆鏂囦歡錛屽Configuration cf = new Configuration.configure("com/myproj/hibernate/configs/hibernate.cfg.xml");
2銆丼essionFactory鎺ュ彛 緙撳瓨浜咰onfiguration瀵硅薄鎵鍖呭惈鐨勯厤緗俊鎭紝鑳芥牴鎹槧灝勪俊鎭嚜鍔ㄧ敓鎴怱QL璇彞錛屽茍鎻愪緵鐢熸垚Session瀵硅薄鐨勬柟娉曘?br />
3銆丼ession鎺ュ彛鎻愪緵涓緋誨垪鎸佷箙鍖栫殑鎿嶄綔銆?br />
鍒版錛屽彲浠ュ啓涓灝忔浠g爜鏉ュ姞鐪嬩笅濡備綍浣跨敤hibernate
Configuration cf = new Configuration.configure("com/myproj/hibernate/configs/hibernate.cfg.xml");//閰嶇疆鏂囦歡涓嶅湪姝や綔浠嬬粛
SessionFactory sessionFactory = cf.buildSessionFactory();
Session session = sessionFactory.openSession();
session.update();
session.save();絳夌瓑鎸佷箙鍖栨搷浣溿?br />
鑷蟲錛岀畝鍗曚粙緇嶄簡hibernate 鏄庢牱宸ヤ綔鐨勶紝鍏跺疄鎴戝彧鎯寵浣犳竻妤氾細“Hibernate鏄釜鐙珛鐨勬鏋訛紝瀹冧笉渚濊禆浠諱綍鐨刉eb Server鎴朅pplication Server錛屽氨鏄涓嶉渶瑕佽繖浜涙敮鎸併?#8221;
閭d箞錛屾垜浠鍥炲埌涓婚鏉ワ細濡備綍闆嗘垚struts涓巋ibernate寮鍙戯紵絳旀寰堢畝鍗曪細hibernate鍜宻truts鏈川涓婃槸娌′粈涔堣仈緋葷殑錛屽彧瑕佷綘璁頒綇錛?span style="color: red">Hibernate鏄釜鐙珛鐨勬鏋訛紝瀹冧笉渚濊禆浠諱綍鐨刉eb Server鎴朅pplication Server銆?/span>鐢―AO妯″紡鎶奾ibernate鎸佷箙鍖栫殑鎿嶄綔灝佽濂斤紝渚涗笟鍔¢昏緫鏈嶅姟綾昏皟鐢ㄥ氨鍙互銆傚洖榪囧ご鏉ョ湅struts宸ヤ綔嫻佹椂搴忓浘鐨勮В閲婄殑絎笁鐐癸細“3錛堿ction璋冪敤涓氬姟閫昏緫鏈嶅姟鎺ュ彛錛岀粨鍚圓ctionForm錛屽鐢ㄦ埛鐨勮姹傚仛鍑哄鐞嗐?/strong>”錛屼笉闅懼緱鍑猴細
鐢ㄦ埛璇鋒眰鍚庯紝struts璐熻矗鎵懼埌鐩稿簲鐨凙ction瀵硅薄錛孉ction璋冪敤涓氬姟閫昏緫鏈嶅姟鎺ュ彛錛屼笟鍔¢昏緫鏈嶅姟鎺ュ彛璋冪敤DAO鎺ュ彛(榪欓噷榛樿鐨勫疄鐜板氨鐢╤ibernate,褰撶劧, 榪樺彲浠ユ湁澶氱瀵規暟鎹簱鎿嶄綔鐨勫疄鐜幫級
hibernate鍏呭綋涓嬮潰榪欏紶鍥句腑鐨?鎸佷箙灞傦紙DAO錛?

鐢變簬鏈漢瀵箂truts鍙奾ibernate璁よ瘑涓嶆繁錛屽啓榪欑瘒鏂囩珷鍙槸鎶涚爾寮曠帀錛屽笇鏈涢珮鎵嬩滑鍙戣〃鎰忚鎸囨閿欒錛屽鎸囨暀銆?br />

]]>
主站蜘蛛池模板:
亚洲一区二区三区丝袜|
精品国产_亚洲人成在线高清|
亚洲图片一区二区|
亚洲精品国偷自产在线|
一出一进一爽一粗一大视频免费的|
污视频网站在线免费看|
精品久久久久成人码免费动漫|
亚洲精品视频在线免费|
亚洲电影免费观看|
www.亚洲色图.com|
偷自拍亚洲视频在线观看99|
国产又粗又猛又爽又黄的免费视频|
亚洲精品久久久www|
老司机亚洲精品影院|
朝桐光亚洲专区在线中文字幕|
啦啦啦www免费视频|
亚洲成av人片在线天堂无|
国产乱子影视频上线免费观看|
亚洲精品成人片在线播放|
免费无码作爱视频|
国产福利免费观看|
又硬又粗又长又爽免费看|
四虎永久在线精品免费观看视频|
亚洲国产精品成人综合久久久|
国产一卡2卡3卡4卡2021免费观看|
日本亚洲免费无线码
|
亚洲电影在线免费观看|
无码国产精品一区二区免费式直播|
亚洲三级高清免费|
国产一区二区三区免费在线观看
|
亚洲av无码一区二区三区乱子伦|
日韩国产欧美亚洲v片|
亚洲精品国产V片在线观看|
国产啪精品视频网站免费尤物
|
亚洲免费视频网址|
久久国产精品成人免费|
在线a亚洲v天堂网2018|
黄色网站软件app在线观看免费|
1区1区3区4区产品亚洲|
在线看片人成视频免费无遮挡|
一级毛片免费播放视频|