PROGRAMMING/JavaScript

[js prototype] attribute 값 읽어오기

OJR 2010. 4. 5. 11:44

http://api.prototypejs.org/dom/element/readattribute/

readAttribute 로 읽어오면 된다.

<span class="time txteventdate b" style="font-size:18px;" time="{$oItem.event_end|countdown:"sec"}">

html 에 time 이른 속성값을 임의로 주고 난다음

그냥 oSpan.time 으로 ie에서는 읽혀지나
firefox 나 다른 브라우저에서는 못읽어온다.

prototype 에서는
다음과 같이 쓰면 할수 있다.

var t = arrTime[i].readAttribute('time')-count;


참고
hasAttribtue, writeAttribute



반응형