웹 페이지에 속해 있는 모든 <a> Tag 들의 "href" 의 경로를 원하는 텍스트만 변경하는 구문.
모바일 기기로 웹페이지 접근시 <a> Tag 경로를 변경해야 하거나 할때 사용.

* jQuery  파일이 인클루드 되어야 합니다.

* .replace() 는 일반 자바스크립트
     (페이지내 다른 스크립트로 인해 간혹 실행되지 않는 페이지 있음. )


                var android_url = "";

                $('a').each(function (index) {

                    android_url = $(this).attr("href");
                    android_url = android_url.replace("/mobile/","/mobile_a/");
                    $(this).attr("href", android_url);
                    //alert($(this).attr("href"));
                });


크리에이티브 커먼즈 라이센스
Creative Commons License
이올린에 북마크하기(0) 이올린에 추천하기(0)

Posted by 홍반장

2010/11/04 18:56 2010/11/04 18:56
, , ,
Response
No Trackback , No Comment
RSS :
http://tcbs17.cafe24.com/tc/rss/response/5617


블로그 이미지

- 홍반장

Archives

Recent Trackbacks

Calendar

«   2024/04   »
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        
Statistics Graph

Site Stats

Total hits:
183059
Today:
448
Yesterday:
607