??xml version="1.0" encoding="utf-8" standalone="yes"?>99久久99久久免费精品蜜臀,九色一区二区,久久天天躁狠狠躁夜夜爽蜜月http://www.aygfsteel.com/blueoxygen/category/3746.htmlBlue keywords,Green comment,Red breakpoint,my life is also colorfulzh-cnFri, 02 Mar 2007 03:32:05 GMTFri, 02 Mar 2007 03:32:05 GMT60[导入]AJAX tool box---Venkmanhttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35582.htmlBlueO2BlueO2Thu, 16 Mar 2006 03:19:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35582.htmlhttp://www.aygfsteel.com/blueoxygen/comments/35582.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35582.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/35582.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/35582.htmlVenkman is a Javascript Debugger as a FireFox extenstion.It's at least powerful than IE's default script debugger(not Visual InterDev's).You can watch varaiable,set breakpoint and use "step over" "step into" "step out" "continue" buttons to debug your niffy javascript codes.
It's ease to use.And tutorial is HERE:http://www.svendtofte.com/code/learning_venkman/index.php

文章来源:http://blueoxygen.dflying.net/3/archive/75_ajax_tool_box---venkman.html

BlueO2 2006-03-16 11:19 发表评论
]]>
[导入]variable's scope in Javascripthttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35584.htmlBlueO2BlueO2Thu, 16 Mar 2006 03:19:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35584.htmlhttp://www.aygfsteel.com/blueoxygen/comments/35584.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35584.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/35584.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/35584.htmlSee DFlying's finding:
Yep,No Block Scope concept in JavaScript.Only the global and function Scope.You can use "var" to declare a global variable and use "var" agian to declare a homonymous variable in a function.In the function ,the second one works.But there is no Block scope.
Check the codes below,it's a demo for "NO BLOCK SCOPE"
function test(o) {var i = 0; // i is defined throughout functionif (typeof o == "object") {var j = 0; // j is defined everywhere, not just blockfor(var k = 0; k < 10; k++) { // k is defined everywhere, not just loopdocument.write(k);

}document.write(k); // k is still defined: prints 10}document.write(j); // j is defined, but may not be initialized}

But,You still need to care javascript's FUNCTION SCOPE.Also see code snippet:
var scope = "global";

function f( ) {alert(scope); // Displays "undefined", not "global"var scope = "local"; // Variable initialized here, but defined everywherealert(scope); // Displays "local"}f( );
Right,thought you alert(scope) first and then define a new functin scope variable scope.However,once you define a function scope vriable,it will hide the global variable in the function body,whatever the definition order.



文章来源:http://blueoxygen.dflying.net/3/archive/68_variables_scope_in_javascript.html

BlueO2 2006-03-16 11:19 发表评论
]]>
[导入]AJAX Auto-complete componenthttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35585.htmlBlueO2BlueO2Thu, 16 Mar 2006 03:19:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35585.htmlhttp://www.aygfsteel.com/blueoxygen/comments/35585.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35585.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/35585.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/35585.html本来还要自己写一个auto-complete,但是大多数此类功能并没有提供类似google suggest提供的键盘选择功能,auto-complete便失去了一大半的交互改善。于是前两天还特意扒了google suggest来看ac.js 发现google定是用了混淆器。虽然代码没有压缩,但是代码的回车空行和函数名字全部混乱。正在要自己写的时候发现了此中国自产的AutoAssist。Very Cool!


AutoAssist is an auto completion web widget that written in pure JavaScript. It can help enhance the accessibility of existing website, let the users to work effective and feel comfortable. AutoAssist Javascript only and is built upon prototype and rico. Its main features are :

* improve the User Experience
* Don't require an Ajax experience
* pretty managed JavaScript, easy to understand and customize
* works well on Mozilla/FireFox, IE and Opera
* have a nice solution for fast user typing, reduce a lot of corresponding server loading (20% - 80% *)

autoassist.png

The code for the screenshot is very simple :

var foo = function() {
var tt = new AutoAssist("t", {setRequestOptions: function() {
var pars = "name=" + this.txtBox.value;
return { url: "/country.php", parameters: pars };
}});
}
Event.observe(window, "load", foo);

You can find a ten minutes tutorial for AutoAssist explaining in details how to use this script to create an auto-complete list based on country data.

By the way,script.aculo.us also has it's impelmention:http://demo.script.aculo.us/ajax/autocompleter


文章来源:http://blueoxygen.dflying.net/3/archive/53_ajax_auto-complete_component.html

BlueO2 2006-03-16 11:19 发表评论
]]>
Prototype Sampleshttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35578.htmlBlueO2BlueO2Thu, 16 Mar 2006 03:18:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35578.htmlhttp://www.aygfsteel.com/blueoxygen/comments/35578.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/03/16/35578.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/35578.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/35578.htmlhttp://blueoxygen.dflying.net/3/archive/20_prototype_samples.html

BlueO2 2006-03-16 11:18 发表评论
]]>
AJAX贴脓怹CZ1-1http://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32101.htmlBlueO2BlueO2Thu, 23 Feb 2006 06:52:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32101.htmlhttp://www.aygfsteel.com/blueoxygen/comments/32101.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32101.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/32101.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/32101.htmlAJAX贴脓怹入门?/A>。本CZ部分操作利用了prototypecdQ?A HREF="/blueoxygen/admin/compdoc2cn.dev.java.net/prototype/html/prototype.js.cn.html">相关知识h?/A>
CZ为我们以前经帔R到过的动态列表问题,当选择一个下拉框的时候,另外一个的数据动态生?BR>result.jpg
q是个极其简单的应用。不q我们讲q入繁Q最后的CZ会展现Google Suggestcd的自动提C。而且我们会不停的Ҏ个示例重构,标题?-1也表明有1-2{?BR>1-1是完全自己处理AJAX的各U问题,1-2预计引入其他cd来操作XMLQ?-3预计用buffalo完成此示例。之后每个示例如果有必要都会有此cd比。由于代码很单ƈ且有注释Q所以文章以代码卛_展现应用?BR>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title> Dynamic List </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<script src="./script/prototype.js"></script>
<script>
var xmlHttp;    //XHR Object
function refreshBookList() {

   var bookCate = $F('bookCate');
   
//clear Books select box
   if(bookCate == ""){
    clearBookList();
    
return;
   }
   
//we use XML file directly for demonstrating.
   //In real application,you should generate *.xml file by server side
   var url;
   
if(bookCate == "SAP"){
    url 
= "./SAP.xml";
   }
else {
    url 
= "./SIEBEL.xml"
   }
   
var pars = "";
   
//Create a new XHR object
   xmlHttp = new Ajax.Request(url,{method: 'get',onComplete: handleListChange});
}
//remove list values of select box
function clearBookList() {
    
var books = $('bookList');
    
while(books.childNodes.length >0){
        books.removeChild(books.childNodes[
0]);
    }
}
//callback function
function handleListChange(originalRequest){
    clearBookList();
    
var books = $('bookList');
    
var results = originalRequest.responseXML;
    
var option = null;
    
var booksXML = results.getElementsByTagName("books")[0];
    
for(var i = 0; i < booksXML.childNodes.length;i++){
        
//get book tag
        var listItem = booksXML.childNodes[i];
        option 
= document.createElement('option');
        option.appendChild(document.createTextNode(listItem.firstChild.nodeValue));
        books.appendChild(option);
    }
}
</script>
</head>

<body>
<form  action="#">
    Book Categroies:
    
<select name="bookCate" id="bookCate" onchange="refreshBookList();">
        
<option>Select One</option>
        
<option value="SAP">SAP Books</option>
        
<option value="SIEBLE">SIEBEL Books</option>
    
</select>
    
<br/><br/>
    
<select name="bookList" id="bookList" size="6" style="width:300px"></select>
    
<br/>
</form>
</body>
</html>
SAP.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<books>
<book>
ABAP
</book>
<book>
BW
</book>
<book>
FI module
</book>
</books>
SIEBEL.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<books>
<book>
SIEBEL
</book>
<book>
CRM
</book>
</books>


BlueO2 2006-02-23 14:52 发表评论
]]>
AJAX Data Transfer Typeshttp://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32079.htmlBlueO2BlueO2Thu, 23 Feb 2006 03:15:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32079.htmlhttp://www.aygfsteel.com/blueoxygen/comments/32079.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/02/23/32079.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/32079.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/32079.htmlAJAX与服务器端通讯Q虽然XHR对象的介入得我们可以异步处理用戯求,但是另外一个细节也暴露l我Q我们如何与服务器统一通信的契U?

目前比较公认的有三种数据传输交互方式QXHTML Fragment,JSON,XML。当然也有不同的声音Q这里也会介l?/P>

  • XHTML片断
q种方式也被UCؓAHAH, 目前很多遗留pȝxAJAX的光改善一下交互,节省一下带宽,大多数采用了此种方式。我们以 StrutsZ子,比如在页面上有一个按钮,点击后得到现在我收藏的图书列表,则此图书列表(Table元素l成)便可以以XHTML片断的Ş式返回客LQ然后利用XHR对象的responseText属性得刎ͼ讄道某DIV中?BR>
for (Iterator it = sortedPresidentsList.iterator(); it.hasNext();) {
HashMap hm 
= (HashMap)it.next();
html 
+= "<tr>";
html 
+= "<td>" + (String)hm.get("firstName"+ "</td>";
html 
+= "<td>" + (String)hm.get("middleName"+ "</td>";
html 
+= "<td>" + (String)hm.get("lastName"+ "</td>";
html 
+= "<td>" + (String)hm.get("firstYearInOffice"+ "</td>";
html 
+= "<td>" + (String)hm.get("lastYearInOffice"+ "</td>";
html 
+= "</tr>";
}

html 
+= "</table>";

// Write the HTML to response
response.setContentType("text/html");
PrintWriter out 
= response.getWriter();
out.println(html);
out.flush();

    q是一个Struts的例子,Action中response直接flush输出。当然也可以让Struts导向到结果jsp面Q请求的XHR可以得到jsp生成的HTML内容?BR>~点是:当返回有Form的内容的时候会崩溃。CSS样式讄复杂?/P>

    • XML

    XML在很多AJAXCZ当中作ؓ数据传递的标准。而XMLh很好的数据语义描q性,服务器端生成方式众多Q而几乎所有浏览器都支持对XML 的解析。以JavaScript解析服务器端q回的XMLZ子,只需要XHR的responseXML属性即可获得XML由javascript解析 (L我在BlogJAVA写的操作CZ) 而XML的生方式似乎所有h都认准了

    <channel>

    <title>Dan's Data</title>
    <description>New and interesting computer hardware, gadgets and toys reviewed. And letters. Lots of letters.</description>
    <link>http://www.dansdata.com/</link>

    <item>
    <title>Ultrasone HFI-650 headphones</title>
    <description>They look like the 550s, they feel like the 550s, they've got marketing buzzwords like the 550s - are they worth the extra money?</description>
    <link>http://www.dansdata.com/quickshot025.htm</link>
    </item>..


    一c,gq样子语义描q更清楚。但是我从michael那里得到启示Q确实,用此cL式传输数据几乎无法在客户端统一处理。从我的showcase中大家也可以看到QJavascript解析XML后更新DOM直就是体力活Q枯燥且Ҏ出错Q而此UXMLq回的数据则会千差万别,以寻扄定tag的节点的方式怎么能统一处理呢?于是Q第二种XML传输方式应运而生?/P>

    <list>
    <type>java.util.List</type>
    <map>
    <type>yourapp.domain.Book</type>
    <string>title</string>
    <string>JavaScript, the Definitive Guide</string>
    <string>publisher</string>
    <string>O'Reilly</string>
    <string>author</string>
    <string>David Flanagan</string>
    <string>cover</string>
    <string>/images/cover_defguide.jpg</string>
    <string>blurb</string>
    <string>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</string>
    </map>
    <map>
    <type>yourapp.domain.Book</type>
    <string>title</string>
    <string>DOM Scripting</string>
    <string>publisher</string>
    <string>Friends of Ed</string>
    <string>author</string>
    <string>Jeremy Keith</string>
    <string>cover</string>
    <string>/images/cover_domscripting.jpg</string>
    <string>blurb</string>
    <string>Praesent et diam a ligula facilisis venenatis.</string>
    </map>
    </list>

    q样子只要客L和服务器端达成共识string long int{代表的数据cd可以在两端q原成自己可用的对象。而这也是micheal认ؓ真正的AJAX应该有的形态,其中AJAX引擎便承担v了这份工作?BR>~点QXML的构造和解析在没有类库辅助的情Ş下是一个灾难,而XML文g的传输效率似乎也不如单的文本高。我讲会在后面的blog中提及XML文g的生方法,以及客户端一些解析的框架?/P>

    • JSON

    JSON是JavaScript Object Notation的羃写,是一份规范,定义了极其简单的数据描述形式。几乎在所有主语a上都有实现。JSON对象是名/值对的集合,所以一个简单的JSON对象为:
    var testObj={
    "name" : david,
    "sex" : Male,
    "work" : SE
    }
    客户端javascript调用eval()可以解析由服务器端产生的JSON丌Ӏvar jsonExpression =
    ( + req.responseText + );
    var customer = eval(jsonExpression);
    而服务器?JAVA)也有相应的lib来操作:JSONObject 的toString()
    ~点Q虽然JSONz高效,但是转化为Javascript对象通过eval()也就是说QAJAX的传输邦定在了JSON上面Q这PM让h不很攑ֿ。ƈ且JSON对象难于阅读与理解,不如XML直观?/P>

    除了会在下一AJAX的blog介绍JAVA对象序列化到XML以外Q会一些从头开始构建应用的例子Q其中不会用buffalo DWR一cȝ框架Q我会尝试选用不同的方案作为数据传输方式供大家参考?/P>

    BlueO2 2006-02-23 11:15 发表评论
    ]]>
    Javascript操作xml小showcase:xml转换为tablehttp://www.aygfsteel.com/blueoxygen/archive/2006/02/15/30882.htmlBlueO2BlueO2Wed, 15 Feb 2006 14:58:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2006/02/15/30882.htmlhttp://www.aygfsteel.com/blueoxygen/comments/30882.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2006/02/15/30882.html#Feedback0http://www.aygfsteel.com/blueoxygen/comments/commentRss/30882.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/30882.html阅读全文

    BlueO2 2006-02-15 22:58 发表评论
    ]]>
    Behaviour.js 真正的清z了htmlQ?/title><link>http://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21354.html</link><dc:creator>BlueO2</dc:creator><author>BlueO2</author><pubDate>Thu, 24 Nov 2005 15:10:00 GMT</pubDate><guid>http://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21354.html</guid><wfw:comment>http://www.aygfsteel.com/blueoxygen/comments/21354.html</wfw:comment><comments>http://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21354.html#Feedback</comments><slash:comments>1</slash:comments><wfw:commentRss>http://www.aygfsteel.com/blueoxygen/comments/commentRss/21354.html</wfw:commentRss><trackback:ping>http://www.aygfsteel.com/blueoxygen/services/trackbacks/21354.html</trackback:ping><description><![CDATA[<P align=justify><A ><FONT face=Arial>http://bennolan.com/behaviour/</FONT></A><FONT face=Arial>   Z避免在html中引入过多的script tagQ尤其现在富客户端应用很火的时候,script写的p发的多?BR>官方|站举了一个这样子的例?BR></P></FONT> <DIV align=justify> <DIV style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee"> <P><FONT size=3><FONT face=Arial><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">div </SPAN><SPAN style="COLOR: #ff0000">id</SPAN><SPAN style="COLOR: #0000ff">="image_16209134_normal"</SPAN><SPAN style="COLOR: #0000ff">></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=3><IMG id=Codehighlighter1_63_152_Open_Image onclick="this.style.display='none'; Codehighlighter1_63_152_Open_Text.style.display='none'; Codehighlighter1_63_152_Closed_Image.style.display='inline'; Codehighlighter1_63_152_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_63_152_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_63_152_Closed_Text.style.display='none'; Codehighlighter1_63_152_Open_Image.style.display='inline'; Codehighlighter1_63_152_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></FONT></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">script </SPAN><SPAN style="COLOR: #ff0000">language</SPAN><SPAN style="COLOR: #0000ff">="Javascript"</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN id=Codehighlighter1_63_152_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN></FONT></FONT><SPAN id=Codehighlighter1_63_152_Open_Text><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><BR><FONT face=Arial size=3><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/InBlock.gif" align=top>photo_hash['</FONT></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">16209134</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">'] </SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> </SPAN><SPAN style="COLOR: #0000ff; BACKGROUND-COLOR: #f5f5f5">new</SPAN></FONT></FONT><FONT size=3><FONT face=Arial><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"> Object();<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align=top>photo_hash['</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">16209134</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">'].title </SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">=</SPAN></FONT></FONT><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5"><FONT face=Arial size=3> '2am on Saturday';<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">script</SPAN><SPAN style="COLOR: #0000ff">></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=3><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">h4 </SPAN><SPAN style="COLOR: #ff0000">id</SPAN><SPAN style="COLOR: #0000ff">="title_div16209134"</SPAN></FONT></FONT><FONT size=3><FONT face=Arial><SPAN style="COLOR: #ff0000"> <BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    style</SPAN><SPAN style="COLOR: #0000ff">="margin-bottom: 0px; margin-top: 0px;"</SPAN><SPAN style="COLOR: #0000ff">></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=3><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top>    2am on Saturday<BR><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">h4</SPAN><SPAN style="COLOR: #0000ff">></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=3><IMG id=Codehighlighter1_292_331_Open_Image onclick="this.style.display='none'; Codehighlighter1_292_331_Open_Text.style.display='none'; Codehighlighter1_292_331_Closed_Image.style.display='inline'; Codehighlighter1_292_331_Closed_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ExpandedBlockStart.gif" align=top><IMG id=Codehighlighter1_292_331_Closed_Image style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_292_331_Closed_Text.style.display='none'; Codehighlighter1_292_331_Open_Image.style.display='inline'; Codehighlighter1_292_331_Open_Text.style.display='inline';" src="http://www.aygfsteel.com/images/OutliningIndicators/ContractedBlock.gif" align=top></FONT></SPAN><FONT size=3><FONT face=Arial><SPAN style="COLOR: #0000ff"><</SPAN><SPAN style="COLOR: #800000">script </SPAN><SPAN style="COLOR: #ff0000">type</SPAN><SPAN style="COLOR: #0000ff">="text/javascript"</SPAN><SPAN style="COLOR: #0000ff">></SPAN><SPAN id=Codehighlighter1_292_331_Closed_Text style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff"><IMG src="http://www.aygfsteel.com/images/dot.gif"></SPAN><SPAN id=Codehighlighter1_292_331_Open_Text><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">initPhotosUserPageTitle_div('</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">16209134</SPAN><SPAN style="COLOR: #000000; BACKGROUND-COLOR: #f5f5f5">');</SPAN></SPAN><SPAN style="COLOR: #0000ff"></</SPAN><SPAN style="COLOR: #800000">script</SPAN><SPAN style="COLOR: #0000ff">></SPAN></FONT></FONT><SPAN style="COLOR: #000000"><BR><FONT face=Arial size=3><IMG src="http://www.aygfsteel.com/images/OutliningIndicators/None.gif" align=top></FONT></SPAN></P></DIV></DIV> <P align=justify><FONT face=Arial>q是Flickr上面一D代码。确实,它得代码阅读v来结构不清晰了。Behavior应用之后Q不需在元素上写明触发事g要执行的ҎQ比?BR><a onclick="this.parentNode.removeChild(this)" href="#"><BR>Click me to delete me<BR></a><BR>而变成了<BR><ul id="example"><BR><li><BR><a href="/someurl">Click me to delete me</a><BR></li><BR></ul><BR>那么javascript如果扑ֈq个a链接q加上onclick事gҎ的呢Q采用css selector<BR></P></FONT> <P align=justify><FONT face=Arial>var myrules = {  <BR>'<span id="wmqeeuq" class=selector>#example li</SPAN>' : function(el){   <BR>el.<span id="wmqeeuq" class=event>onclick</SPAN> = function(){    <BR><span id="wmqeeuq" class=beh>this.parentNode.removeChild(this);</SPAN>   <BR>} }};<BR><STRONG>Behaviour.register(myrules);</STRONG> 实看v来,html清爽了,但是Q却引入了其他的元素。okQ我们可以ؓ每个控g定义idQ其实也未尝不可Qasp.net不也是web component开发的时候都定义id的么Q可g又脱裤子攑ֱ之嫌。在l护一个对某一l应用相同样式或响应<BR>相同Ҏ的html控g上应用behaviorQ有意义Qv码不必每个上面都写上onclick之类的,但是对于更普遍的应用Q每个html控g要做得事情是不同的啊。那个时候,不但用behavior代码量增加了Q而且l护一个var myrules里的内容和去删除控g上的onclick其实工作量差不多。真正的应用可不是demo啊,列出来一排link写着remove meQ然后执行一L动作?<BR>不过正如我上面说的,q是有一定的应用场景的,大家可以在有此需求的时候考虑Q还有一Behaviour.js<BR><BR><BR><BR><BR><BR></FONT></P><img src ="http://www.aygfsteel.com/blueoxygen/aggbug/21354.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.aygfsteel.com/blueoxygen/" target="_blank">BlueO2</a> 2005-11-24 23:10 <a href="http://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21354.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>AJAX贴脓?入门?http://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21197.htmlBlueO2BlueO2Wed, 23 Nov 2005 16:21:00 GMThttp://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21197.htmlhttp://www.aygfsteel.com/blueoxygen/comments/21197.htmlhttp://www.aygfsteel.com/blueoxygen/archive/2005/11/24/21197.html#Feedback1http://www.aygfsteel.com/blueoxygen/comments/commentRss/21197.htmlhttp://www.aygfsteel.com/blueoxygen/services/trackbacks/21197.html阅读全文

    BlueO2 2005-11-24 00:21 发表评论
    ]]>
    վ֩ģ壺 ľ˹| | | Դ| Դ| | ˱| ˮ| | | | С| Ϫ| °Ͷ| | ʡ| Ȫ| | | ߴ| Ҷ| | ƽ| ;| | | | | | ƽ| | ԭ| | | | ξ| ̨| | | ˮ| |