亚洲aⅴ网站,久久国产小视频,999精品一区http://www.aygfsteel.com/alinglau36/category/43952.htmlone platform thousands thinkingzh-cnThu, 02 Nov 2017 21:44:46 GMTThu, 02 Nov 2017 21:44:46 GMT60jQuery.template()http://www.aygfsteel.com/alinglau36/archive/2011/11/02/362514.htmllaulauWed, 02 Nov 2011 02:41:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/11/02/362514.htmlhttp://www.aygfsteel.com/alinglau36/comments/362514.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/11/02/362514.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/362514.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/362514.htmlhttp://api.jquery.com/jQuery.template/

lau 2011-11-02 10:41 發(fā)表評(píng)論
]]>
jQuery hoverIntenthttp://www.aygfsteel.com/alinglau36/archive/2011/11/02/362513.htmllaulauWed, 02 Nov 2011 02:40:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/11/02/362513.htmlhttp://www.aygfsteel.com/alinglau36/comments/362513.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/11/02/362513.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/362513.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/362513.htmlhttp://cherne.net/brian/resources/jquery.hoverIntent.html

What is hoverIntent?

hoverIntent is a plug-in that attempts to determine the user's intent... like a crystal ball, only with mouse movement! It works like (and was derived from) hover. However, instead of immediately calling the onMouseOver function, it waits until the user's mouse slows down enough before making the call.

Why? To delay or prevent the accidental firing of animations or ajax calls. Simple timeouts work for small areas, but if your target area is large it may execute regardless of intent.

Download hoverIntent r6 (fully-commented, uncompressed)

Download hoverIntent r6 (minified)

hoverIntent r6 (2011) has all the same functionality of r5 (2007) except that the Google Chrome defect (known defects) is fixed once you upgrade to jQuery 1.5.1.

Translations

Беларуская courtesy Martha Ruszkowski

Examples

jQuery's hover (for reference)

$("#demo1 li").hover( makeTall, makeShort )
  •  
  •  
  •  
  • hover ignores over/out events from children

jQuery's built-in hover calls onMouseOver/onMouseOut functions immediately.

hoverIntent as hover replacement

$("#demo2 li").hoverIntent( makeTall, makeShort )
  •  
  •  
  •  
  • hoverIntent also ignores over/out events from children

hoverIntent is interchangeable with jQuery's hover. It can use the same exact onMouseOver and onMouseOut functions and it passes the same this and event objects to those functions.

hoverIntent with configuration object

var config = {    
over: makeTall, // function = onMouseOver callback (REQUIRED)
timeout: 500, // number = milliseconds delay before onMouseOut
out: makeShort // function = onMouseOut callback (REQUIRED)
};

$("#demo3 li").hoverIntent( config )
  •  
  •  
  •  
  •  

To override the default configuration of hoverIntent, pass it an object as the first (and only) parameter. The object must contain "over" and "out" functions, in addition to any other options you'd like to override.

Basic Configuration Options

The "timeout" delay (by default set to 0) will mostly likely be the one you'll want to override. The "over" and "out" functions are required but nothing prevents you from sending an empty function(){} to either.

over:

Required. The function you'd like to call onMouseOver. Your function receives the same "this" and "event" objects as it would from jQuery's hover method.

timeout:

A simple delay, in milliseconds, before the "out" function is called. If the user mouses back over the element before the timeout has expired the "out" function will not be called (nor will the "over" function be called). This is primarily to protect against sloppy/human mousing trajectories that temporarily (and unintentionally) take the user off of the target element... giving them time to return. Default timeout: 0

out:

Required. The function you'd like to call onMouseOut. Your function receives the same "this" and "event" objects as it would from jQuery's hover method. Note, hoverIntent will only call the "out" function if the "over" function has been called on that same run.

Advanced Configuration Options

When choosing the default settings for hoverIntent I tried to find the best possible balance between responsiveness and frequency of false positives. Modify these if you are brave, test tirelessly, and completely understand what you are doing.

sensitivity:

If the mouse travels fewer than this number of pixels between polling intervals, then the "over" function will be called. With the minimum sensitivity threshold of 1, the mouse must not move between polling intervals. With higher sensitivity thresholds you are more likely to receive a false positive. Default sensitivity: 7

interval:

The number of milliseconds hoverIntent waits between reading/comparing mouse coordinates. When the user's mouse first enters the element its coordinates are recorded. The soonest the "over" function can be called is after a single polling interval. Setting the polling interval higher will increase the delay before the first possible "over" call, but also increases the time to the next point of comparison. Default interval: 100

Notice of DOM Manipulation

hoverIntent adds two custom attributes to every DOM element it's assigned to. For example: <li hoverIntent_t="" hoverIntent_s="">

  • hoverIntent_t is the polling interval timer, or the mouseOut timer.
  • hoverIntent_s stores the state to prevent unmatched function calls.

Timers are stored as integers, so there should not be any trouble with memory leaks. hoverIntent state is also stored as an integer.

Known Defects

hoverIntent r5 suffers from a defect in Google Chrome that improperly triggers mouseout when entering a child input[type="text"] element. hoverIntent r6 uses the same mouseenter/mouseleave special events as jQuery's built-in hover, and jQuery 1.5.1 patched this issue. Thanks to Colin Stuart for tipping me off about this and for providing isolated code to demonstrate/test.

This page uses jQuery 1.5.1+ and hoverIntent r6, so when your cursor goes over the text input nothing should change (it should continue to read "enter parent" because you are still over this paragraph).

However, if you were using Google Chrome and if this page were using an older version of jQuery or hoverIntent, moving the cursor over the text input would improperly trigger the mouseout event, and the value would change to "leave parent".

If you place an element with onMouseOut event listeners flush against the edge of the browser chrome, sometimes Internet Explorer does not trigger an onMouseOut event immediately if your mouse leaves the document. hoverIntent does not correct for this.

jQuery's hover can take both a handlerIn and a handlerOut or just a handlerIn. The current version of hoverIntent requires both handlerIn and handlerOut or a single configuration object. It was not designed to take just a handlerIn like hover. This will be addressed in a future release.

Please email me ( brian@cherne.net ) if you have questions or would like to notify me of any defects. I will tweet about any updates from @briancherne using the tags #hoverIntent #jQuery.

The Future of hoverIntent

hoverIntent r7 (in development) will be backwards compatible with all current implementations and include hoverIntent custom events.

Release History

  • r7 = In development. Adding custom events.
  • r6 = Current stable release. Updated to correct for Google Chrome defect.
  • r5 = Added state to prevent unmatched function calls. This release (and previous releases) suffers from a defect in Google Chrome that improperly triggers mouseout when entering a child input[type=text] element.
  • r4 = Fixed polling interval timing issue (now uses a self-calling timeout to avoid interval irregularities).
  • r3 = Developer-only release for debugging.
  • r2 = Added timeout and interval references to DOM object -- keeps timers separate from each other. Added configurable options. Added timeout option to delay onMouseOut function call. Fixed two-interval mouseOver bug (now setting pX and pY onMouseOver instead of hardcoded value).
  • r1 = Initial release to jQuery discussion forum for feedback.


lau 2011-11-02 10:40 發(fā)表評(píng)論
]]>
IE9 Only CSS Hackhttp://www.aygfsteel.com/alinglau36/archive/2011/11/01/362433.htmllaulauTue, 01 Nov 2011 03:49:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/11/01/362433.htmlhttp://www.aygfsteel.com/alinglau36/comments/362433.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/11/01/362433.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/362433.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/362433.htmlhttp://blog.vervestudios.co/blog/post/2011/05/13/IE9-Only-CSS-Hack.aspx

#element {
    color:orange;
}
#element {
    *color: white;    /* IE6+7, doesn't work in IE8/9 as IE7 */
}
#element {
    _color: red;     /* IE6 */
}
#element {
    color: green\0/IE8+9; /* IE8+9  */
}
:root #element { color:pink \0/IE9; }  /* IE9 */


lau 2011-11-01 11:49 發(fā)表評(píng)論
]]>
The Essentials of Writing High Quality JavaScript http://www.aygfsteel.com/alinglau36/archive/2011/09/16/358793.htmllaulauFri, 16 Sep 2011 06:38:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/09/16/358793.htmlhttp://www.aygfsteel.com/alinglau36/comments/358793.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/09/16/358793.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/358793.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/358793.htmlgood stuff:

http://net.tutsplus.com/tutorials/javascript-ajax/the-essentials-of-writing-high-quality-javascript/

lau 2011-09-16 14:38 發(fā)表評(píng)論
]]>
hack css in safari and operahttp://www.aygfsteel.com/alinglau36/archive/2011/08/11/356312.htmllaulauThu, 11 Aug 2011 08:16:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/08/11/356312.htmlhttp://www.aygfsteel.com/alinglau36/comments/356312.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/08/11/356312.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/356312.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/356312.html

@media all and (min-width: 0px){ }opera和safari都支持
@media screen and (-webkit-min-device-pixel-ratio:0){}
這個(gè)只支持safari,以前做表單統(tǒng)一樣式的時(shí)候研究過。
如果想?yún)^(qū)分opera和safari的話先寫
@media all and (min-width: 0px){
}
然后寫
@media screen and (-webkit-min-device-pixel-ratio:0){}
就OK了

div{ width:100px; height:200px;}
@media all and (min-width: 0px){ div{ background:red} }
@media screen and (-webkit-min-device-pixel-ratio:0){div{background:#000}}

可以試下



lau 2011-08-11 16:16 發(fā)表評(píng)論
]]>
freemarker數(shù)字格式化帶來的操作問題http://www.aygfsteel.com/alinglau36/archive/2011/07/13/354284.htmllaulauWed, 13 Jul 2011 09:37:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/07/13/354284.htmlhttp://www.aygfsteel.com/alinglau36/comments/354284.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/07/13/354284.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/354284.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/354284.html    1、在模板中直接加.toString()轉(zhuǎn)化數(shù)字為字符串,如:${languageList.id.toString()};
    2、在freemarker配置文件freemarker.properties加<#setting number_format="#">或者      <#setting number_format="0">;
    3、在模板中直接加<#setting number_format="#">或者<#setting number_format="0">,如:<#if AdminLanguagePaginationMsg?exists>
<#setting number_format="#">

lau 2011-07-13 17:37 發(fā)表評(píng)論
]]>
關(guān)于JavaScript中apply與call的用法意義及區(qū)別(轉(zhuǎn))http://www.aygfsteel.com/alinglau36/archive/2011/04/11/348038.htmllaulauMon, 11 Apr 2011 02:27:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/04/11/348038.htmlhttp://www.aygfsteel.com/alinglau36/comments/348038.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/04/11/348038.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/348038.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/348038.html 關(guān)于JavaScript中apply與call的用法意義及區(qū)別(轉(zhuǎn))

JavaScript中有一個(gè)call和apply方法,其作用基本相同,但也有略微的區(qū)別。

先來看看JS手冊(cè)中對(duì)call的解釋:

call 方法
調(diào)用一個(gè)對(duì)象的一個(gè)方法,以另一個(gè)對(duì)象替換當(dāng)前對(duì)象。

call([thisObj[,arg1[, arg2[,   [,.argN]]]]])

參數(shù)
thisObj
可選項(xiàng)。將被用作當(dāng)前對(duì)象的對(duì)象。

arg1, arg2,  , argN
可選項(xiàng)。將被傳遞方法參數(shù)序列。

說明
call 方法可以用來代替另一個(gè)對(duì)象調(diào)用一個(gè)方法。call 方法可將一個(gè)函數(shù)的對(duì)象上下文從初始的上下文改變?yōu)橛?thisObj 指定的新對(duì)象。

如果沒有提供 thisObj 參數(shù),那么 Global 對(duì)象被用作 thisObj。

說明白一點(diǎn)其實(shí)就是更改對(duì)象的內(nèi)部指針,即改變對(duì)象的this指向的內(nèi)容。這在面向?qū)ο蟮膉s編程過程中有時(shí)是很有用的。

引用網(wǎng)上一個(gè)代碼段,運(yùn)行后自然就明白其道理。

<input type="text" id="myText"   value="input text">
<script>
    
function Obj(){this.value="對(duì)象!";}
    
var value="global 變量";
    
function Fun1(){alert(this.value);}

    window.Fun1();   
//global 變量
    Fun1.call(window);  //global 變量
    Fun1.call(document.getElementById('myText'));  //input text
    Fun1.call(new Obj());   //對(duì)象!
</script>

call函數(shù)和apply方法的第一個(gè)參數(shù)都是要傳入給當(dāng)前對(duì)象的對(duì)象,及函數(shù)內(nèi)部的this。后面的參數(shù)都是傳遞給當(dāng)前對(duì)象的參數(shù)。
運(yùn)行如下代碼:
<script>
   
var func=new function(){this.a="func"}
    
var myfunc=function(x){
        
var a="myfunc";
        alert(
this.a);
        alert(x);
    }
    myfunc.call(func,
"var");
</script>

可見分別彈出了func和var。到這里就對(duì)call的每個(gè)參數(shù)的意義有所了解了。

對(duì)于apply和call兩者在作用上是相同的,但兩者在參數(shù)上有區(qū)別的。
對(duì)于第一個(gè)參數(shù)意義都一樣,但對(duì)第二個(gè)參數(shù):
apply傳入的是一個(gè)參數(shù)數(shù)組,也就是將多個(gè)參數(shù)組合成為一個(gè)數(shù)組傳入,而call則作為call的參數(shù)傳入(從第二個(gè)參數(shù)開始)。

如 func.call(func1,var1,var2,var3)對(duì)應(yīng)的apply寫法為:func.apply(func1,[var1,var2,var3])

同時(shí)使用apply的好處是可以直接將當(dāng)前函數(shù)的arguments對(duì)象作為apply的第二個(gè)參數(shù)傳入


lau 2011-04-11 10:27 發(fā)表評(píng)論
]]>
Freemarker操作字符串http://www.aygfsteel.com/alinglau36/archive/2011/02/23/344970.htmllaulauWed, 23 Feb 2011 06:04:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/02/23/344970.htmlhttp://www.aygfsteel.com/alinglau36/comments/344970.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/02/23/344970.html#Feedback3http://www.aygfsteel.com/alinglau36/comments/commentRss/344970.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/344970.html1、substring(start,end)從一個(gè)字符串中截取子串
start:截取子串開始的索引,start必須大于等于0,小于等于end
end: 截取子串的長(zhǎng)度,end必須大于等于0,小于等于字符串長(zhǎng)度,如果省略該參數(shù),默認(rèn)為字符串長(zhǎng)度。
例子:
${‘str’?substring(0)}à結(jié)果為str
${‘str’?substring(1)}à結(jié)果為tr
${‘str’?substring(2)}à結(jié)果為r
${‘str’?substring(3)}à結(jié)果為
${‘str’?substring(0,0)}à結(jié)果為
${‘str’?substring(0,1)}à結(jié)果為s
${‘str’?substring(0,2)}à結(jié)果為st
${‘str’?substring(0,3)}à結(jié)果為str

2、cap_first 將字符串中的第一個(gè)單詞的首字母變?yōu)榇髮憽?br /> ${‘str’?cap_first}à結(jié)果為Str
3、uncap_first將字符串中的第一個(gè)單詞的首字母變?yōu)樾憽?br /> ${‘Str’?cap_first}à結(jié)果為str
4、 capitalize將字符串中的所有單詞的首字母變?yōu)榇髮?br /> ${‘str’? capitalize}à結(jié)果為STR

5、 date,time,datetime將字符串轉(zhuǎn)換為日期
例如:
<#assign date1=”2009-10-12”?date(“yyyy-MM-dd”)>
<#assign date2=”9:28:20”?time(“HH:mm:ss”)>
<#assign date3=” 2009-10-12 9:28:20”?time(“HH:mm:ss”)>
${date1}à結(jié)果為2009-10-12
${date2}à結(jié)果為9:28:20
${date3}à結(jié)果為2009-10-12 9:28:20
注意:如果指定的字符串格式不正確將引發(fā)錯(cuò)誤。

6、ends_with 判斷某個(gè)字符串是否由某個(gè)子串結(jié)尾,返回布爾值。
${“string”?ends_with(“ing”)?string} 返回結(jié)果為true
注意:布爾值必須轉(zhuǎn)換為字符串才能輸出

7、html 用于將字符串中的<、>、&和“替換為對(duì)應(yīng)得&lt;&gt;&quot:&amp

8、index_of(substring,start)在字符串中查找某個(gè)子串,返回找到子串的第一個(gè)字符的索引,如果沒有找到子串,則返回-1。
Start參數(shù)用于指定從字符串的那個(gè)索引處開始搜索,start為數(shù)字值。
如果start大于字符串長(zhǎng)度,則start取值等于字符串長(zhǎng)度,如果start小于0, 則start取值為0。
${“string”?index_of(“in”) à結(jié)果為3
${“string”?index_of(“ab”) à結(jié)果為-1

9、length返回字符串的長(zhǎng)度 ${“string”?length}à結(jié)果為6

10、lower_case將字符串轉(zhuǎn)為小寫
${“STRING”?lower_case}à結(jié)果為string

11、upper_case將字符串轉(zhuǎn)為大寫
${“string”?upper_case}à結(jié)果為STRING

12、contains 判斷字符中是否包含某個(gè)子串。返回布爾值
${“string”?contains(“ing”)?string} à結(jié)果為true
注意:布爾值必須轉(zhuǎn)換為字符串才能輸出

13、number將字符串轉(zhuǎn)換為數(shù)字
${“111.11”?number}à結(jié)果為111.11

14、replace用于將字符串中的一部分從左到右替換為另外的字符串。
${“strabg”?replace(“ab”,”in”)} à結(jié)果為string

15、split使用指定的分隔符將一個(gè)字符串拆分為一組字符串

<#list “This|is|split”?split(“|”) as s>
${s}
</#list>
結(jié)果為:
This
is
split

16、 trim 刪除字符串首尾空格 ${“ String ”?trim} à結(jié)果為String

如果本文對(duì)您有幫助并且要鼓勵(lì)我的話,請(qǐng)掃描如下二維碼支持本人的勞動(dòng)成果,多謝了!




lau 2011-02-23 14:04 發(fā)表評(píng)論
]]>
你不知道的 JavaScript - “this”http://www.aygfsteel.com/alinglau36/archive/2011/02/09/344000.htmllaulauWed, 09 Feb 2011 15:25:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/02/09/344000.htmlhttp://www.aygfsteel.com/alinglau36/comments/344000.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/02/09/344000.html#Feedback1http://www.aygfsteel.com/alinglau36/comments/commentRss/344000.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/344000.html
pretty good, worth reading.



lau 2011-02-09 23:25 發(fā)表評(píng)論
]]>
YAHOO.util.Dom之尋找節(jié)點(diǎn)(轉(zhuǎn))http://www.aygfsteel.com/alinglau36/archive/2011/02/01/343835.htmllaulauTue, 01 Feb 2011 00:55:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/02/01/343835.htmlhttp://www.aygfsteel.com/alinglau36/comments/343835.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/02/01/343835.html#Feedback1http://www.aygfsteel.com/alinglau36/comments/commentRss/343835.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/343835.htmlYAHOO.util.Dom之尋找節(jié)點(diǎn)

YUI的Dom方法一共有45個(gè),在這里談一下我學(xué)習(xí)過程遇到的問題和經(jīng)驗(yàn),先介紹17個(gè)尋找節(jié)點(diǎn)類型的Dom方法。

get(el):記得初學(xué)JavaScript的時(shí)候,最先認(rèn)識(shí)的兩個(gè)方法就是getElementById和 getElementsByTagName,這兩個(gè)東東也基本上能夠找到大多數(shù)你需要找的東西啦。YUI里的get方法跟getElementById類 似,但是它的能力卻要強(qiáng)很多了,el可以是String、HTMLElement或者Array。

getElementsBy ( method , tag , root , apply , o , overrides ):這個(gè)會(huì)和getElementsByTagName比較像一點(diǎn)點(diǎn)吧,但是功能差好遠(yuǎn),基本上getElementsBy應(yīng)該可以找到一切你想找的元 素,method是定義一個(gè)校驗(yàn)?zāi)繕?biāo)元素的方法,返回一個(gè)boolean值,tag是目標(biāo)元素的nodeName,root是指在哪個(gè)元素中進(jìn)行尋找,也 可以說成是一個(gè)范圍吧。apply,我必須要說下它。。當(dāng)初它困擾我了半天,YUI給出的解釋是“A function to apply to each element when found ”,可以理解為一個(gè)回調(diào)函數(shù)吧,再看看YUI的代碼,其中有這么一段:

if (apply) {
Y.Dom.batch(nodes, apply, o, overrides);
}

我當(dāng)時(shí)的理解是,因?yàn)樽罱K返回的是一個(gè)節(jié)點(diǎn)的數(shù)組嘛,我就以為執(zhí)行完前邊的校驗(yàn)后得到的結(jié)果再在apply中進(jìn)行一次,也就是我在apply中再對(duì) 結(jié)果元素進(jìn)行下一步的節(jié)點(diǎn)尋找,那么最后返回的應(yīng)該是apply執(zhí)行后得到的所有節(jié)點(diǎn)集合。。。可是無論我怎么試,最終返回的都是通過method方法所 得到數(shù)組,并沒有再次通過apply獲得更多的元素,嘿嘿,不要見笑哈,當(dāng)時(shí)就是這么想的。。。后來發(fā)現(xiàn),實(shí)際上不是這樣子,我理解錯(cuò)誤的原因只要就在那 個(gè)batch上,當(dāng)時(shí)的錯(cuò)誤在于,我把batch放進(jìn)getElementsBy里了,那么在batch里邊return后應(yīng)該不會(huì)再繼續(xù)執(zhí)行 return nodes了,但是實(shí)際上這里的Y.Dom.batch(nodes, apply, o, overrides)只是一個(gè)最終的結(jié)果而已,所以return nodes還是會(huì)執(zhí)行的。那么這個(gè)apply的作用在何處呢?其實(shí)作用就是執(zhí)行一次回調(diào)嘛哈,它是可以實(shí)現(xiàn)我之前的想法的,但是不是直接返回的,舉個(gè)例 子:

var uls = YAHOO.util.Dom.getElementsBy(function(el){
return el.className === 'J_tab';
},'ul','content');

這是尋找id為content的容器下className為J_tab的節(jié)點(diǎn),那么如果我同時(shí)還需要獲取每個(gè)ul下的所有l(wèi)i節(jié)點(diǎn)該怎么做呢,總不能再來一次循環(huán)吧,當(dāng)然也可以啦,不過要好好利用下YUI吧,那就是讓它獲取ul的同時(shí)獲取li:

var lis = [];
function getli(obj) {
lis.push(obj.getElementsByTagName('li'));
}
var uls = YAHOO.util.Dom.getElementsBy(function(el){
return el.className === 'J_tab';
},'ul','content',getli);

OK,這樣子就一舉兩得了哈~后邊的作用域和上下文就不多說啦,關(guān)于batch的神奇,下次再說哈,真的很神奇。。。

getElementBy ( method , tag , root ):這個(gè)就是通過method校驗(yàn)的第一個(gè)元素。

getElementsByClassName ( className , tag , root , apply , o , overrides ):是通過className進(jìn)行元素尋找,其實(shí)這個(gè)方法是getElementsBy的一個(gè)特殊方法。

getChildren ( node ):這個(gè)與Dom中的childNode類似。

getChildrenBy ( node , method ):通過method方法過濾子元素,注意參數(shù)的順序以及node不可為id。

getFirstChild ( node ):尋找第一個(gè)子元素,跟Dom中的firstChild有些類似。

getFirstChildBy ( node , method ):尋找第一個(gè)通過method校驗(yàn)的子元素,注意參數(shù)的順序以及node不可為id。其實(shí)這個(gè)等同于getChildrenBy得到的第一個(gè)元素。

getLastChild ( node ):尋找最后一個(gè)子元素,與Dom中的lastChild有些類似。

getLastChildBy ( node , method ):與getFirstChildBy相反,倒著尋找。

getAncestorBy ( node , method ):尋找父節(jié)點(diǎn),可以無限的往上級(jí)尋找,直到找到為止,node不能為id,跟Dom中的parentNode類似,不過這里不用反復(fù)的parentNode啦。

getAncestorByClassName ( node , className ):通過className尋找父節(jié)點(diǎn),是getAncestorBy的一個(gè)特殊方法。

getAncestorByTagName ( node , tagName ):通過tagName尋找父節(jié)點(diǎn),是getAncestorBy的一個(gè)特殊方法。

getNextSibling ( node ):尋找緊挨的下一個(gè)同級(jí)非文本節(jié)點(diǎn)的節(jié)點(diǎn),與Dom中的nextSibling類似,省去了判斷文本節(jié)點(diǎn)麻煩。

getNextSiblingBy ( node , method ):無限的往下找直到找到通過method校驗(yàn)的同級(jí)非文本節(jié)點(diǎn),node不能為id,有了這個(gè)方法就不用無限的nextSibling啦。

getPreviousSibling ( node ):尋找緊挨的上一個(gè)同級(jí)非文本節(jié)點(diǎn)的節(jié)點(diǎn),與Dom中的previousSibling類似,可以省去判斷文本節(jié)點(diǎn)的麻煩。

getPreviousSiblingBy ( node , method ):無限的往前找直到找到通過method校驗(yàn)的同級(jí)非文本節(jié)點(diǎn),node不能為id。



lau 2011-02-01 08:55 發(fā)表評(píng)論
]]>
Type mismatch in IEhttp://www.aygfsteel.com/alinglau36/archive/2011/01/26/343562.htmllaulauWed, 26 Jan 2011 03:35:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/01/26/343562.htmlhttp://www.aygfsteel.com/alinglau36/comments/343562.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/01/26/343562.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/343562.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/343562.htmlA:
I am writing an AJAX application.

Here is a piece of my code:

http.open("GET", fullURL, true);
http.onreadystatechange = handleHttpResponse;

the handleHttpResponse is the function that processes the returned data.

If I wanted to pass a string in to handleHttpResponse, I use:

= handleHttpResponse(user_name);

function handleHttpResponse_remtrip(string) {
alert(string);
.. other code ..
}

This generates a "Type mismatch" error. What gives?


B:
if you do this:

http.onreadystatechange = handleHttpResponse(user_name);

then you are assigning the returned value of handleHttpResponse and not the function itself.

You could try this:

http.onreadystatechange = createFunc(user_name);

function createFunc(v) {
return function() {
alert(v);
}
}



lau 2011-01-26 11:35 發(fā)表評(píng)論
]]>
Ajax demohttp://www.aygfsteel.com/alinglau36/archive/2011/01/07/342530.htmllaulauFri, 07 Jan 2011 09:55:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2011/01/07/342530.htmlhttp://www.aygfsteel.com/alinglau36/comments/342530.htmlhttp://www.aygfsteel.com/alinglau36/archive/2011/01/07/342530.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/342530.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/342530.html

lau 2011-01-07 17:55 發(fā)表評(píng)論
]]>
JavaScript:prototype屬性使用方法(轉(zhuǎn))http://www.aygfsteel.com/alinglau36/archive/2010/12/10/340271.htmllaulauFri, 10 Dec 2010 07:57:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/12/10/340271.htmlhttp://www.aygfsteel.com/alinglau36/comments/340271.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/12/10/340271.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/340271.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/340271.html 轉(zhuǎn)自此http://blog.csdn.net/xiaoyuemian/archive/2009/01/20/3844305.aspx
  1. function MyObject(name, size)  
  2. {  
  3.     this.name = name;  
  4.     this.size = size;  
  5. }  
  6.   
  7. MyObject.prototype.color = "red";  
  8. MyObject.prototype.tellColor = function()  
  9. {  
  10.     return "color of "+this.name+" is "+this.color;  
  11. }  
  12.   
  13. var myobj1 = new MyObject("tiddles", "7.5 meters");  
  14. domDiv.innerHTML += myobj1.tellColor()+"<br /><br />";  
  15.   
  16.          
  17.   
  18.        MyObject.prototype.color = "green";  
  19.   
  20.          
  21.   
  22.        domDiv.innerHTML += myobj1.tellColor()+"<br /><br />"; 


lau 2010-12-10 15:57 發(fā)表評(píng)論
]]>
YUI學(xué)習(xí)筆記http://www.aygfsteel.com/alinglau36/archive/2010/06/29/324793.htmllaulauTue, 29 Jun 2010 08:55:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/06/29/324793.htmlhttp://www.aygfsteel.com/alinglau36/comments/324793.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/06/29/324793.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/324793.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/324793.html 最近要寫個(gè)網(wǎng)頁項(xiàng)目,需要很多動(dòng)態(tài)功能,本來想用自己非常熟悉的AS3來做,后來無意中了解了YUI,發(fā)現(xiàn)其實(shí)現(xiàn)的功能非常強(qiáng)大,而且架構(gòu)和AS3很接近。于是花了兩個(gè)小時(shí)到其官方網(wǎng)站http://developer.yahoo.com/yui/上深入學(xué)習(xí)了一下,解決了項(xiàng)目中一些原來非常棘手的問題。

這里是些學(xué)習(xí)筆記:

================連接類==================
1- YUI connect:
var callback =
{
success: function(res) {}, //正常返回處理函數(shù)
failure: function(res) {}, //出錯(cuò)返回處理函數(shù)
argument: [argument1, argument2, argument3] //可以在success函數(shù)和failure函數(shù)中訪

問的變量
}
var transaction = YAHOO.util.Connect.asyncRequest(’GET’, sUrl, callback,

null);

2- 發(fā)送表單:
YAHOO.util.Connect.setForm(formId);
var cObj = YAHOO.util.Connect.asyncRequest(’POST’, ‘http://www.yahoo.com’,

callback);

查看請(qǐng)求是否已經(jīng)處理完
var cObj = YAHOO.util.Connect.asyncRequest(’

GET’,''http://www.yahoo.com’,callback);
var callStatus = YAHOO.util.Connect.isCallInProgress(cObj);

超時(shí)取消請(qǐng)求

var cObj = YAHOO.util.Connect.asyncRequest(’GET’, sUrl, callback);
setTimeout(”YAHOO.util.Connect.abort(cObj)”,10000);

================事件類==================
3- 事件偵聽
YAHOO.util.Event.addListener(element,eventType,fn,obj,override)
參數(shù):
element:為綁定事件的元素id,可以是一個(gè)數(shù)組,以支持批量操作
eventType:為事件類型
fn:為事件響應(yīng)的回調(diào)函數(shù)
obj:當(dāng)override為true時(shí),為回調(diào)函數(shù)傳入的參數(shù)對(duì)象;當(dāng)override為false時(shí),該參數(shù)被

忽略。
override:
返回值類型:Boolean
功能:給指定的element綁定事件響應(yīng)函數(shù)

4- 刪除事件偵聽
YAHOO.util.Event.removeListener:function(element,eventType,fn)
參數(shù):
element:為綁定事件的元素id,
eventType:事件類型
fn:為事件響應(yīng)函數(shù)
返回值類型:Boolean
功能:給指定的element解除綁定事件

5- 偵聽裝載完成
YAHOO.util.Event.onContentReady ( p_id , p_fn , p_obj , p_override )
參數(shù):
p_id:為綁定事件的元素id,
p_fn:為事件響應(yīng)函數(shù)
p_obj:同addListener的obj參數(shù)
p_override:同addListener的override參數(shù)
返回值類型:無
功能:與onAvailable類似,但不同的是事件響應(yīng)函數(shù)是等到element可以安全的修改的時(shí)候

才響應(yīng)。

6- 偵聽DOM第一次可用時(shí)執(zhí)行響應(yīng)函數(shù)
YAHOO.util.Event.onDOMReady ( p_fn , p_obj , p_scope )
參數(shù):
p_fn:為事件響應(yīng)函數(shù)
p_obj:同addListener的obj參數(shù)
p_scope:同addListener的override參數(shù)
返回值類型:無
功能:當(dāng)DOM第一次可用時(shí)執(zhí)行響應(yīng)函數(shù)。

7- 返回偵聽對(duì)象
YAHOO.util.Event.getListeners ( el , sType )
參數(shù):
el:HTML element
sType:事件類型,String類型
返回值類型:Object{
type:事件類型
 fn:addListener添加的事件響應(yīng)函數(shù)
 obj:提供給事件響應(yīng)函數(shù)的參數(shù)對(duì)象
 adjust:否獲取缺省的事件監(jiān)聽器
 index:UI事件監(jiān)聽器列表中的位置
}

來源:(http://blog.sina.com.cn/s/blog_5d41b3800100gmap.html) - YUI學(xué)習(xí)筆記_千峰_新浪博客

8- 獲取事件發(fā)生時(shí)的時(shí)間
YAHOO.util.Event.getTime( event)
參數(shù):
event:事件對(duì)象
返回值類型:Date對(duì)象

9- 獲取事件發(fā)生時(shí)的頁面標(biāo)簽。對(duì)于IE即window.event.srcElement
YAHOO.util.Event.getTarget(ev , resolveTextNode)
參數(shù):
evt:事件對(duì)象
resolveTextNode:
返回值類型: HTML element

10- 創(chuàng)建和使用自定義的事件
A.使用CustomerEvent對(duì)象創(chuàng)建自己的事件
function TestObj(name) {
this.name = name;
this.event1 = new YAHOO.util.CustomEvent(”event1〃, this);
}
YAHOO.util.CustomEvent = function(type, oScope);
type表示事件類型的字符串
B.注冊(cè)對(duì)自定義事件的響應(yīng)函數(shù)
function Consumer(name, testObj) {
this.name = name;
this.testObj = testObj;
this.testObj.event1.subscribe(this.onEvent1, this);
}
C.響應(yīng)函數(shù)
Consumer.prototype.onEvent1 = function(type, args, me) {
alert(” this: ” + this +
“"n this.name: ” + this.name +
“"n type: ” + type +
“"n args[0].data: ” + args[0].data +
“"n me.name: ” + me.name);
}

11- 當(dāng)。。。時(shí)處理
YAHOO.util.Event.on("toolbar", "focusin", function(e) {  
   YAHOO.log("target: " + e.target.id);  
});  
或者:
YAHOO.util.Event.on("btn", "click", move);
var move = function(e){...};
<button id="btn">確認(rèn)</button>

12- 獲取當(dāng)前鼠標(biāo)位置
var move=function(e){
   YAHOO.util.Dom.setXY('foo', YAHOO.util.Event.getXY(e));
};

============YAHOO.lang工具===========
包含了語言工具

============YAHOO.widget組件工具===========
包含了很多小的工具,如月歷,菜單,表格,對(duì)話框,進(jìn)度條,文本編輯框,樹型表,

Uploader等等。(類似于flash的組件)
1- YAHOO.widget.Button
2- YAHOO.widget.ButtonGroup
3- YAHOO.widget.AutoComplete//自動(dòng)填寫表單,將數(shù)據(jù)或遠(yuǎn)程數(shù)據(jù)寫入數(shù)組
4- YAHOO.widget.Calendar//日歷
5- YAHOO.widget.Carousel//圖片預(yù)覽顯示
6- YAHOO.widget.ColorPicker
7- YAHOO.widget.Container//包含Module, Overlay, Panel, Tooltip, Dialog,

SimpleDialog)
8- YAHOO.widget.DataTable//類似EXCEL的數(shù)據(jù)表格
9- YAHOO.widget.ImageCropper//圖像裁剪器
10- YAHOO.widget.LayoutManager
11- YAHOO.widget.Menu
12- YAHOO.widget.Paginator//分頁顯示器
13- YAHOO.widget.ProgressBar
14- YAHOO.widget.Editor/SimpleEditor//可以做成網(wǎng)頁編輯器,功能很多
15- YAHOO.widget.Slider
16- YAHOO.widget.Tab//標(biāo)簽頁
17- YAHOO.widget.TreeView
18- YAHOO.widget.Uploader//文件上傳組件,要和swf一起使用
19- YAHOO.widget.Charts//圖表,生成flash圖表

============YAHOO.lang.JSON工具===========

============YAHOO.util.Element工具===========
1- 新建元素
var el = new YAHOO.util.Element('foo');//新建一個(gè)id為foo的元件
el.setStyle("color", "#f00");//設(shè)置style
el.on('click', function(e){alert(e.target.getStyle('color'));});//設(shè)置事件偵聽
el.get('id');//獲取id屬性
el.get('childNodes');//獲取子節(jié)點(diǎn)數(shù)目
el.get('firstChild');//獲取第一個(gè)節(jié)點(diǎn)
el.hasChildNodes();//檢測(cè)是否有子節(jié)點(diǎn)
el.removeChild(el.get('firstChild'));//刪除第一個(gè)子節(jié)點(diǎn)
el.appendChild(child);//增加節(jié)點(diǎn)
el.getElementsByTageName(tag);//獲取tagName為tag的所有元素
el.insertBefore(element,before);//在元素before前插入element
el.replaceChild(newNode,oldNode);//替換節(jié)點(diǎn)

============YAHOO.util.Dom工具===========
//----元素訪問----
YAHOO.util.Dom.get(element);//==document.getElementById(element);
YAHOO.util.Dom.getElementsBy(method,tagName,[rootNode]);//在指定子節(jié)點(diǎn)下,通過指

定的方式method找元素
YAHOO.util.Dom.getElementsByClassName(className, tagName, [rootNode]);//根據(jù)

class和id找元素
YAHOO.util.Dom.inDocument(el);//判斷元素是否在當(dāng)前DOM中
//----class樣式訪問和控制-----
YAHOO.util.Dom.hasClass(element, className);//判斷element上是否使用了className的

class
YAHOO.util.Dom.addClass(element, className);//給指定element增加class
YAHOO.util.Dom.removeClass(element,className);//刪除element上名為className的

class
YAHOO.util.Dom.replaceClass(element, oldClassName, newClassName);//更新
YAHOO.util.Dom.getStyle(element, property);//獲取element的style中指定的屬性值
YAHOO.util.Dom.setStyle(element, property, value);//設(shè)定屬性值
//----元素位置訪問和控制----
YAHOO.util.Dom.setX('element', value);
YAHOO.util.Dom.setY
YAHOO.util.Dom.setXY('element', point:Point);
YAHOO.util.Dom.getX
YAHOO.util.Dom.getXY('element');//返回Point對(duì)象
YAHOO.util.Dom.getRegin;//獲取Region對(duì)象{left,top,right,bottom}
YAHOO.util.Dom.getClientWidth;//獲取頁面可視面積的高度和寬度
YAHOO.util.Dom.getClientHeight;//
YAHOO.util.Dom.getDocumentWidth;//獲取文檔的高度和寬度
YAHOO.util.Dom.getDocumentHeight;//
YAHOO.util.Dom.getViewportHeight;//獲取頁面可視區(qū)域的高度和寬度(不含滾動(dòng)條)
YAHOO.util.Dom.getViewportWidth;
//----Regin對(duì)象----
YAHOO.util.Region.contains(region);//判斷是否包含了region區(qū)域
YAHOO.util.Region.getArea;//計(jì)算面積
YAHOO.util.Region.intersect(region);//計(jì)算相交區(qū)域
YAHOO.util.Region.union(region);//計(jì)算兩個(gè)區(qū)域并集
//----Point對(duì)象{x,y}----
可以使用數(shù)組一次性操作多個(gè)元素,如:
YAHOO.util.Dom.setStyle(['el1','el2'],'opacity',0.5);

============YAHOO.util.Resize尺寸變化工具===========

Source from http://blog.sina.com.cn/s/blog_5d41b3800100gmap.html



lau 2010-06-29 16:55 發(fā)表評(píng)論
]]>
Event 鼠標(biāo)位置屬性http://www.aygfsteel.com/alinglau36/archive/2010/06/25/324490.htmllaulauFri, 25 Jun 2010 10:02:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/06/25/324490.htmlhttp://www.aygfsteel.com/alinglau36/comments/324490.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/06/25/324490.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/324490.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/324490.htmlEvent 鼠標(biāo)位置屬性


lau 2010-06-25 18:02 發(fā)表評(píng)論
]]>
firefox event is not definedhttp://www.aygfsteel.com/alinglau36/archive/2010/05/07/320258.htmllaulauFri, 07 May 2010 02:43:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/05/07/320258.htmlhttp://www.aygfsteel.com/alinglau36/comments/320258.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/05/07/320258.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/320258.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/320258.htmlfunction   showTip(e){
event   
=   window.event   ||   e;
var   div3   =   document.getElementById( 'div3 ');  
div3.style.display
= "block ";  
div3.style.left
=event.clientX;  
div3.style.top
=event.clientY;
div3.style.position
= "absolute ";  
}


在FIREFOX中,ENENT要顯示的傳給函數(shù)

onmousemove= "showTip(event) " 



lau 2010-05-07 10:43 發(fā)表評(píng)論
]]>
圖片IMG與容器下邊界有空隙的解決方法-Div+CSS教程http://www.aygfsteel.com/alinglau36/archive/2010/03/18/315757.htmllaulauThu, 18 Mar 2010 03:33:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/03/18/315757.htmlhttp://www.aygfsteel.com/alinglau36/comments/315757.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/03/18/315757.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/315757.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/315757.html
div css xhtml xml Example Source Code Example Source Code [www.mb5u.com]
img{display:block}

第二,定義容器里的字體大小為0。
div css xhtml xml Example Source Code Example Source Code [www.mb5u.com]
div {
width:110px;
border:1px solid #000000;
font-size:0
}

第三,定義圖片img標(biāo)簽vertical-align:bottom,vertical-align:middle,vertical-align:top
div css xhtml xml Example Source Code Example Source Code [www.mb5u.com]
img{vertical-align:bottom}


其他還有把圖片下邊距設(shè)為負(fù)值和改寫HTML標(biāo)簽的排列。我覺得前三種就完全可以解決了。

造成圖片在IE下與容器下邊界有空隙的原因

在網(wǎng)上搜了一下,發(fā)現(xiàn)old9說的

圖 片文字等inline元素默認(rèn)是和父級(jí)元素的baseline對(duì)齊的,而baseline又和父級(jí)底邊有一定距離(這個(gè)距離和 font-size,font-family 相關(guān),不一定是 5px),所以設(shè)置 vertical-align:top/bottom/text-top/text-bottom 都可以避免這種情況出現(xiàn)。而且不光li,其他的block元素中包含img也會(huì)有這個(gè)現(xiàn)象。

至于這里的HTML屬性align="center"(對(duì)于圖片瀏覽器會(huì)處理成align="middle"),就相當(dāng)于vertical-align:middle; 所以道理也是一樣的,只要vertical-align不取baseline,這個(gè)空隙就消失了。

相關(guān)評(píng)論

1.ie的顯示有幾種模式,在html文檔的開始部分聲明<!DOCTYPE ....>
假如聲明為strict模式,ie以w3c的方式顯示文檔,而w3c的標(biāo)準(zhǔn)里面<img />默認(rèn)是一個(gè)inline的標(biāo)簽,除非自己顯式的聲明為 block

2.那個(gè)空隙是ie針對(duì)盒模型默認(rèn)的line-height和font-size. 給img desplay:block;雖然能解決問題,但沒從結(jié)構(gòu)上來考慮.可謂治標(biāo)不治本.

lau 2010-03-18 11:33 發(fā)表評(píng)論
]]>
IE6行高line-height失效問題方法詳解http://www.aygfsteel.com/alinglau36/archive/2010/02/21/313554.htmllaulauSun, 21 Feb 2010 09:16:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/02/21/313554.htmlhttp://www.aygfsteel.com/alinglau36/comments/313554.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/02/21/313554.html#Feedback0http://www.aygfsteel.com/alinglau36/comments/commentRss/313554.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/313554.html以前做面面IE6行高問題,總出.但為了省時(shí)間,都改用PADDING撐起來去解決了....就直接不用行高解決.今天有空又在網(wǎng)上查了查.總結(jié)一下解決方法!

因?yàn)閘i中加入圖片,會(huì)導(dǎo)致line-height失效如:
當(dāng)在一個(gè)容器里文字和img、input、textarea、select、object等元素相連的時(shí)候,對(duì)這個(gè)容器設(shè)置的line-height數(shù)值會(huì)失效; 同時(shí)以上元素的行高可能×2:

受 影響的瀏覽器: Microsoft Internet Explorer 5.01 / Windows  Microsoft Internet Explorer 5.5 / Windows  Microsoft Internet Explorer 6&nbsp;

解決方法:
對(duì)和文字相連接的img、input、textarea、select、object等元素加以屬性

margin: (所屬line-height-自身img,input,select,object高度)/2px 0;vertical-align:middle;
 下面是源代碼可直接復(fù)制下到本地演示:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " <html xmlns=" <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/base.css">
<style>
.hh li{ line-height:50px; }
.hh li img{margin:20px 0;vertical-align:middle; } <!--所屬line-height-自身img,input,select,object高度)/2px -->

</style>
<title>布丁足跡</title>
</head>

<body>
<ul class="hh">
   <li id="qwe"><a href="
.布丁足跡</a><img src="http://www.ddhbb.com/blog/image/logo/xml.gif" /></li>
   <li id="qwe"><a href="
.布丁足跡</a><img src="http://www.ddhbb.com/blog/image/logo/xml.gif" /></li>
   <li id="qwe"><a href="
.布丁足跡</a><img src="http://www.ddhbb.com/blog/image/logo/xml.gif" /></li>
   <li id="qwe"><a href="
.布丁足跡</a><img src="http://www.ddhbb.com/blog/image/logo/xml.gif" /></li>
   <li><a href="
.布丁足跡</a></li>
   <li><a href="
.布丁足跡</a></li>
   <li><a href="
.布丁足跡</a></li>
   <li><a href="
.布丁足跡</a></li>
</ul>
</body>
</html>

lau 2010-02-21 17:16 發(fā)表評(píng)論
]]>
CSS hack:區(qū)分IE6,IE7,firefoxhttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312528.htmllaulauWed, 10 Feb 2010 08:14:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312528.htmlhttp://www.aygfsteel.com/alinglau36/comments/312528.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312528.html#Feedback2http://www.aygfsteel.com/alinglau36/comments/commentRss/312528.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/312528.html

CSS hack:區(qū)分IE6,IE7,firefox

區(qū)別不同瀏覽器,CSS hack寫法:


區(qū)別IE6FF
       background:orange;*background:blue;

區(qū)別IE6IE7
       background:green !important;background:blue;

區(qū)別IE7FF
       background:orange*background:green;

區(qū)別FFIE7IE6
       background:orange;*background:green !important;*background:blue;

注:IE都能識(shí)別*;標(biāo)準(zhǔn)瀏覽器(如FF)不能識(shí)別*;
IE6能識(shí)別*,但不能識(shí)別 !important,
IE7能識(shí)別*,也能識(shí)別!important;
FF不能識(shí)別*,但能識(shí)別!important;


IE6 IE7 FF
* ×
!important ×

_ × ×

#
× ×


另外再補(bǔ)充一個(gè),下劃線"_",
IE6支持下劃線,IE7和firefox均不支持下劃線。

于是大家還可以這樣來區(qū)分IE6IE7firefox
: background:orange;*background:green;_background:blue;

注:不管是什么方法,書寫的順序都是firefox的寫在前面,IE7的寫在中間,IE6的寫在最后面。




相關(guān):


lau 2010-02-10 16:14 發(fā)表評(píng)論
]]>
Web browser hacks, Css hacks - ie, firefox, chrome, safri, Operahttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312518.htmllaulauWed, 10 Feb 2010 06:44:00 GMThttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312518.htmlhttp://www.aygfsteel.com/alinglau36/comments/312518.htmlhttp://www.aygfsteel.com/alinglau36/archive/2010/02/10/312518.html#Feedback1http://www.aygfsteel.com/alinglau36/comments/commentRss/312518.htmlhttp://www.aygfsteel.com/alinglau36/services/trackbacks/312518.htmlCSS hacks take advantage of browser bugs for hiding CssRules from specific web browsers. Listed below are the hacks for major browsers like ie6, ie7, firefox2, firefox3, Google chrome, safari and opera.

Inline Hack for IE

* (star) can be used as the inline hack for both ie6 and ie7.

For Example:

Syntax: .selector{*property:value;}

.logo{*margin-left:10px;}

IE6 browser inline Hack

_ (underscore) can be using only for ie6

For Example:

Syntax: .selector{_property:value;}

.logo{_margin-left:10px;}

Firefox inline style

content:"\"/*" can be used for firefox only where IE cannot recognize it.

Internal Style

Use * html for ie6 and *+html hack for ie7

For Example:

Synatax: * html .selector{property:value;} , * + html .selector{property:value;}

* html .logo{margin-left:10px;} for ie6

* + html .logo{margin-left:20px;} for ie7

IE7 and Firefox browser Hack

Use html>body hack for ie7 and firefox.

For Example:

Syntax: html>body .selector{property:value;}

html>body .logo{margin-left:10px} will take only in ie7 and firefox

Mordern browser Hack or Firefox Hack

Use html>/**/body {} hack which will support only in both firefox2 and firefox3.

For Example:

Syntax: html>/**/body .selector{property:value;}

html>/**/body .logo{margin-left:10px} will take only in firefox.

Browser hack for Opera versions 9 and below

Use html:first-child {} for opera browser. Also you use

Syntax: @media all and (min-width:0px) {head~body .selector {property:value;}}

For Example:

@media all and (min-width:0px) {head~body .logo {margin-left:10px;}} only for opera

Firefox3 browser hack

Use html>/**/body .selector, x:-moz-any-link, x:default {property:value;} for firfox3 only.

For Example:

Syntax: html>/**/body .pro_yl, x:-moz-any-link, x:default {background:red;}

Google Chrome browser hack

Use body:nth-of-type(1) .elementOrClassName{property:value;} only for google chrome.

For Example:

body:nth-of-type(1) .logo{margin:20px;}

Safari browser hack

Use Syntax: body:first-of-type .elementOrClassName{property:value;}

Fox Example:

body:first-of-type .logo{margin-top:10px;} only for safari.

Hope this information will be useful for you. Please use the browser hacks in a proper manner. For example, you might know double margin bug in ie6. In such case you can use display inline which will render correctly by all the browsers instead of you using ie6 hack seperately

lau 2010-02-10 14:44 發(fā)表評(píng)論
]]>
主站蜘蛛池模板: 吉首市| 武山县| 东乡族自治县| 白银市| 乡城县| 札达县| 夏津县| 叙永县| 江油市| 丽江市| 视频| 湛江市| 武宣县| 安吉县| 阜南县| 茌平县| 光泽县| 平和县| 黄石市| 天长市| 宁城县| 西青区| 昌图县| 延长县| 获嘉县| 泸溪县| 湘西| 石屏县| 密山市| 奈曼旗| 淮阳县| 正定县| 阳东县| 土默特右旗| 长岭县| 潢川县| 南郑县| 察哈| 江阴市| 清涧县| 九龙城区|