ลองมองดูดาวบนท้องฟ้ายามค่ำคืน แล้วเราจะพบว่าจริงๆแล้ว "ตัวเรา" เล็กสักเพียงไหนในจักรวาลนี้ ชีวิตเป็นเรื่องเพียงช่วงเวลาแสนสั้น วันนี้คุณทำดีกับคน "ที่คุณรัก" ก่อนที่จะสายเกินไปแล้วหรือยัง?
Group Blog
 
<<
กรกฏาคม 2550
1234567
891011121314
15161718192021
22232425262728
293031 
 
6 กรกฏาคม 2550
 
All Blogs
 

การเปลี่ยนรูปภาพหลังชื่อใน comment




วันนี้เราจะมาเปลี่ยนรูปโลโก้ ที่อยู่ด้านหลังชื่อใน comment กันดู

หลังจากแกะมาแล้ว ก็พบว่าเป็นการใช้ javascript ในการเข้าไปเปลี่ยนแปลง source code ของ <html>

โดยทำการ copy script นี้ไปไว้ในส่วนของ Script Area เพื่อให้ทำงานในขณะที่ load หน้า blog


<script>
iCount=document.images.length;
for(i=0;i<iCount;i++){
if(document.images[i].src=="//www.bloggang.com/images/smile.gif") {document.images[i].src="//url.jpg"}
}
</script>


ซึ่งหลักการของ code นี้ก็คือการเข้าไปทำการเปลี่ยนแปลงในระดับ source code ของ html คือ
1. ทำการค้นหาตำแหน่งที่เป็นชื่อไฟล์ของรูปโลโก้ ซึ่งก็คือไฟล์ชื่อ smile.gif นั่นเอง
2. จากนั้นทำการเปลี่ยนแปลง source code ชื่อไฟล์ รวมทั้งตำแหน่งที่เก็บไฟล์ให้เป็นไฟล์รูปภาพที่เราต้องการ "//url.jpg" ตามที่ mark ใน code เป็นสีแดง นั่นเอง

และในหลักการวิธีเดียวกันนี้ ก็สามารถที่จะนำไปใช้ในหลายๆ เทคนิคได้อีก อย่าง เปลี่ยนข้อความสำหรับความคิดเห็นแต่ละความคิดเห็น หรือ เปลี่ยน link กลุ่มบล็อก เป็นรูปภาพ ฯลฯ

ตามความเห็นส่วนตัวแล้ว ก็เป็นวิธีที่ดี แต่ก็พยายามอย่าให้เยอะมาก เพราะอย่าลืมว่ามันต้องประมวลผลทุกครั้งที่ทำการแสดงผลหน้า blog นะครับ

ขอให้สนุกกับการเป็น blogger นะครับ




 

Create Date : 06 กรกฎาคม 2550
8 comments
Last Update : 3 กันยายน 2550 16:25:20 น.
Counter : 1082 Pageviews.

 

โห..อธิบายละเอียดดีมากเลยค่ะ ทำให้เข้าใจง่ายขึ้น
ขอบคุณค่า

 

โดย: mrs.postman 30 กรกฎาคม 2550 15:35:16 น.  

 

ขอบคุณมากคะ

 

โดย: missy pink poison 13 สิงหาคม 2550 9:13:57 น.  

 

ทำไมทำแล้วไม่เห็นเปลี่ยนอ่ะ ไม่เข้าใจช่วยบอกหน่อยได้ป่าว

 

โดย: กีรดา 19 สิงหาคม 2550 20:16:09 น.  

 

โค้ดผิดนะค่ะ .. ดิฉันก็ทำตั้งหลายครั้งแล้ว ก็ยังไม่ได้

ดูไปดูมา ผลปรากฏว่า โค้ดที่คุณให้มาน่ะผิด ยังไงก็ช่วยแก้ด้วยนะค่ะ

 

โดย: เรื่องเล่า...ก่อนเข้านอน 23 สิงหาคม 2550 21:40:47 น.  

 

ขอบคุณครับ คุณ "เรื่องเล่า.."

code ตรง loop for มันผิดเล็กน้อย ต้องขออภัยไว้ด้วยครับ

แต่แก้ไขแล้ว

 

โดย: chengake 3 กันยายน 2550 16:26:44 น.  

 

Here was someone immersed in a search for truth and beauty. Words had been cheap timberland boots treasured, words that were beautiful. And I felt as if the words timberland waterproof boots somehow delighted in being discovered, for they were obviously very generous to the as yet anonymous timberland work boots writer of the notes. And now this person was in turn learning the secret of sharing them. Beauty so shines when given away. There were timberland 6 inch sensitivity and a beauty to her that have nothing to do with timberland 6 inch boots looks. She was one to be listened to, whose words were so easy to take to timberland boots sale heart.I used to find notes left in the collection basket, beautiful timberland boots outlet notes about my homilies and about the writer's black timberland boots thoughts on the daily scriptural readings. The person who penned the notes mens timberland boots would add reflections to my thoughts and would always include some timberland pro boots quotes from poets and mystics he or she had white timberland boots read and remembered and loved. The notes fascinated black timberland shoes uk me.The only truth that exists timberland hiking boots is, in that sense, free. //www.timberland6inch.com/ xy

 

โดย: cheap timberland boots IP: 117.26.222.147 7 กันยายน 2553 14:41:17 น.  

 

 

โดย: linghuicute 4 กันยายน 2555 22:15:48 น.  

 

Your content so unique and informative and here the free social bookmarking sites list and high da pa website list 2021 so you can easy way share your link in this website easy way to register and submit link and social bookmarking sites.
https://freesocialbookmarking.org/

 

โดย: social bookmarking sites IP: 139.99.104.93 5 พฤษภาคม 2564 15:11:33 น.  

ชื่อ :
Comment :
  *ใช้ code html ตกแต่งข้อความได้เฉพาะสมาชิก
 


chengake
Location :


[ดู Profile ทั้งหมด]

ฝากข้อความหลังไมค์
Rss Feed

ผู้ติดตามบล็อก : 1 คน [?]




คู่ชีวิตใหม่ที่วัยเกินมันส์แล้ว กำลังรอคอยเจ้าตัวน้อยสมาชิกใหม่ของครอบครัวอยู่
แก้ไขรัฐทำมะนวย
Friends' blogs
[Add chengake's blog to your web]
Links
 

 Pantip.com | PantipMarket.com | Pantown.com | © 2004 BlogGang.com allrights reserved.