« Gmail spam mails always have checked sign 大學教育已經完全屬於營利事業的性質 »
Wed 18 Jun 2008
今天達人講了個 css2js 的網頁,不錯用。大致上,就是原來 CSS 裡面有 ‘-’ 的,例如 ‘a-b’ 的話,要用 javascript 來 呼叫的話就是用 ‘aB’。同理,’a-b-c’ 就是 ‘aBC’。如果是 ‘abc’ 的話,那轉過去就還是 ‘abc’ ,不過也有例外:
- float → styleFloat
另外就是有些遇到 ‘:’ 的時候,可以比照 ‘-’ 來處理:
- text-decoration: blink → textDecorationBlink
- text-decoration: line-through → textDecorationLineThrough
- text-decoration: none → textDecorationNone
- text-decoration: overline → textDecorationOverline
- text-decoration: underline → textDecorationUnderline
在 HTML tag 裡面,雖然 javascript 可以使用 setAttribute() 來更改 tag 中裡面的設定,比方說 <a href=”lala”> 我們可以抓到這個 node 之後(比方說用 getElementsByTagName(’a')),用 node.setAttribute(’value’,'lala’)。這樣就會變成 <a value=”lala” href=”lala”> 不過如果牽涉到 style 的話,不建議這樣使用,因為可能會修改到本來存在的 style,或者在多個函式都會對這個 node 設定 style 的時候,使用 setAttribute(’style’,'its value’) 就會有 race condition 的問題發生(譬如用了 GM_xmlhttpRequest 或是類似的函式),所以比較好的方式還是使用 node.style. 來做設定。
June 24th, 2008 at 4:16 pm
真難,隔行如隔山.你以後不打算從事中醫業嗎?
June 24th, 2008 at 5:01 pm
blake 兄應該會是現代柯琴吧 :)
June 26th, 2008 at 5:33 pm
簡單回答希拉君,在目前狀況不變之下,小弟未來從事中醫業的機會非常小。
July 15th, 2008 at 8:56 am
>>我想问句题外话,你这款wordpress的主题(theme)叫什么名字,或者给个地址,我想要。
在footer里面看到了,thanks。