Tech & Tips

1. นำ Windows Media Player มาใช้ใน Website
     
         การนำ Windows Media Player จะช่วยให้เว็บไซด์สามารถนำเสนอเนื้อหาที่เป็น Video ให้ อันทำให้ตัวเว็บไซด์มีความน่าสนใจมากยิ่งขึ้น ซึ่งการใช้งานมีไม่ยาก แค่นำ Code ส่วนนี้ไปใส่ในส่วน bodyใน html โดยสามารถเลือกใส่ในส่วนไหนก็ได้ตามใจชอบ

<object width="100%" height="100%"ขนาดของตัวเครื่องเล่น
type="video/x-ms-asf" url="3d.wmv" data="3d.wmv"ที่อยู่ของไฟล์ที่ใช้ในการเล่น
classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
<param name="url" value="3d.wmv">ที่อยู่ของไฟล์ที่ใช้ในการเล่น 
<param name="filename" value="3d.wmv">ชื่อไฟล์ที่ใช้ในการเล่น 
<param name="autostart" value="1">เล่นทันทีที่เปิดเว็บหรือไม่ 0 คือไม่ใช่ 1 คือใช่
<param name="uiMode" value="full" />
<param name="autosize" value="1">ปรับขนาดโดยอัตโนมัติหรือไม่ 0 คือไม่ใช่ 1 คือใช่
<param name="playcount" value="1">
<embed type="application/x-mplayer2" src="3d.wmv" width="100%" height="100%" autostart="true" showcontrols="true" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"></embed>
</object>

ตัวอย่างการใช้งาน



เครื่องเล่น Windows Media Player บนเว็บ


2. การเปลี่ยนสี Scroll Bar
      

              แถบ Scroll Bar หากมีการเพิ่มสีสัน จะช่วยให้เว็บไซด์นั้นน่าใช้งานยิ่งขึ้น ซึ่งการใช้ก็ไม่ยาก เพียงแค่นำ Code ด้านล่างไปไว้ที่ <head> ในไฟล์ HTML

<script language="javascript">
var begcolor='#330066';        //STARTING COLOR AS A HEX STRING
var endcolor='#CCFFCC';        //ENDING COLOR AS A HEX STRING
var steps=50;                          //TOTAL CHANGE STEPS FROM ONE COLOR TO THE OTHER
var delay=50;                          // DELAY BETWEEN EACH COLOR CHANGE. LOWER IS FASTER.

//*** DO NOT EDIT BEYOND THIS POINT ***\\

var data=new Array();
var ie5=(document.getElementById && document.all)? true: false;

function colorset(num){
this.beg=parseInt('0x'+begcolor.substring(num,num+2));
this.end=parseInt('0x'+endcolor.substring(num,num+2));
this.up=this.startup=(this.end>=this.beg)? true : false;
this.incr=Math.abs(this.end-this.beg)/steps;
this.current=this.beg;
}

function changecolors(){
var color=new Array();
for(i=1;i<=3; i++){
(data[i].up)? data[i].current+=data[i].incr : data[i].current-=data[i].incr;
if(data[i].startup){
if(data[i].current>=data[i].end){ data[i].up=false; data[i].current=data[i].end}
if(data[i].current<=data[i].beg){ data[i].up=true; data[i].current=data[i].beg }
}
if(!data[i].startup){
if(data[i].current<=data[i].end){ data[i].up=true; data[i].current=data[i].end}
if(data[i].current>=data[i].beg){ data[i].up=false; data[i].current=data[i].beg}
}
color[i]=data[i].current;
}
color[4]=Math.floor(color[1]).toString(16); if(color[4].length==1)color[4]='0'+color[4];
color[5]=Math.floor(color[2]).toString(16); if(color[5].length==1)color[5]='0'+color[5];
color[6]=Math.floor(color[3]).toString(16); if(color[6].length==1)color[6]='0'+color[6];
document.body.style.scrollbarBaseColor='#'+color[4]+color[5]+color[6];
}

window.onload=function(){
if(ie5){
for(i=1, j=1;i<=3; i++, j+=2)data[i]=new colorset(j);
document.body.style.scrollbarBaseColor=begcolor;
setInterval('changecolors()',delay);
}else alert('This script only works for Internet Explorer browsers version 5.5 and up.');
}
</script>

ตัวอย่างการใช้งาน


แถบสีบน Scroll Bar จะเปลี่ยนไปเรื่อยๆ

หมายเหตุ : ใช้ได้เฉพาะ Internet Explorer เท่านั้น
3.ใส่ตัวแปลภาษาของ Google Translate เพื่อแปลเนื้อหาเว็บไซด์

         การใส่ Google Translate ลงในเว็บจะเพิ่มความสะดวกแก่ผู้ใช้ทั่วโลก เพราะตัวนี้สามารถแปลหน้าเอกสารบนหน้าเว็บให้เป็นภาษาที่ผู้ใช้ต้องการได้ ซึ่งการใช้งานมีไม่ยาก แค่นำ Code ส่วนนี้ไปใส่ในส่วน body ใน html โดยสามารถเลือกใส่ในส่วนไหนก็ได้ ตามใจชอบ

<div id="google_translate_element"></div>
<script>
functiongoogleTranslateElementInit() {  
newgoogle.translate.TranslateElement({  
pageLanguage: 'th',  ภาษาของหน้า
includedLanguages: 'ko,zh-TW,zh-CN,ja,th,fr,ms,de,en'  ระบุภาษาที่ต้องการได้ โดยใส่เป็นตัวย่อของภาษานั้นๆ
  }, 'google_translate_element');  
}  
</script><script src="http://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit"></script>



ตัวอย่างการใช้งาน

สามารถแปลภาษาบนหน้าเว็บได้ (ไวยากรณ์อาจไม่ถูกต้อง 100%)

ไม่มีความคิดเห็น:

แสดงความคิดเห็น