Posted by: ทวี | มีนาคม 20, 2007

Object Oriented Programming using JavaScript

Subclasses and Superclasses :

<script language="javascript" contenttype="text/javascript">
<!--

function superTest() {
return “superTest”
}

function subTest() {
return “subTest”
}

function superClass() {
this.supertest = superTest; //attach method superTest
}

function subClass() {
this.inheritFrom = superClass;
this.inheritFrom();
this.subtest = subTest; //attach method subtest
}

newClass = new subClass();
document.write(newClass.subtest()); //yields “subTest”
document.write(”<br/>”);
document.write(newClass.supertest()); //yields “superTest”
//–>
</script>

Posted by: ทวี | มีนาคม 19, 2007

Top 10 JavaScript functions of all time

Posted by: ทวี | มีนาคม 19, 2007

Object Oriented Programming Using JavaScript

Object Creation :

<script language=”javascript” contenttype=”text/javascript”>
<!–
// object creation using ‘new Object()’
person = new Object()
person.name = “Tim Scarfe”
person.height = “6Ft”
person.run = function() {
this.state = “running”
this.speed = “4ms^-1″
}

// Object creation using Literals
timObject = {
property1 : “Hello”,
property2 : “HmmMMm”,
property3 : ["mmm", 2, 3, 6, "kkk"],
method1 : function() {
document.write(”Method had been called ” + this.property1)
}
}

// Object constructor and prototyping
function cat(name) {
this.name = name;
this.talk = function() {
document.write(this.name + ” say meeow!”)
}
}

// Adding methods to our object using prototype
cat.prototype.changeName = function(newName) {
this.name = newName;
}
//–>
</script>

Posted by: ทวี | มีนาคม 12, 2007

CSS syntax short note

  • The stylesheet file references :
    <link ref=’stylesheet’ type=’text/css’ href=’path/to/style.css’ />
  • The common selector :
    tag { property: value }
  • The group selector :
    tag0,[tag1],[tag2],… { property: value }
  • The class selector :
    [tag].class_name { property: value }
  • The tag with particular attributes selector :
    tag[attr='value'] { property : value }
  • The id selector :
    [tag]#tag_id { property : value }
  • The CSS comment :
    /* …… */
Posted by: ทวี | มีนาคม 6, 2007

พจนานุกวนโอ้ย

  • บุหรี่ : ใบยาสูบที่มีกระดาษพันอยู่ โดยมีไฟติดอยู่อีกข้างหนึ่ง และมีคนโง่อยู่อีกข้างหนึ่ง
  • หย่า : Future tense ของคำว่า ” แต่งงาน”
  • เลกเชอร์ : ศิลปะในการถ่ายทอดข้อมูลจากกระดาษโน้ตของอาจารย์ ไปยัง กระดาษโน้ตของนักศึกษา โดยที่ไม่ผ่านหัวสมองของทั้ง 2 ฝ่าย
  • ประชุม : ความงุนงงของคนคนหนึ่งที่ มีมากขึ้นเมื่อเหตุการณ์จบลง
  • ยินยอม : ศิลปะในการแบ่ง เค้กให้ทุกๆคน โดยทำให้แต่ล่ะคนคิดว่าตนเองได้เค้กชิ้นใหญ่สุด
  • น้ำตา : พลังน้ำที่ผู้หญิง สามารถสยบความแข็งแกร่งของพลังงานแห่งความเป็นชายได้
  • พจนานุกรม : ที่เดียวที่คำว่า Success มาก่อนคำ ว่า Work
  • ห้องประชุม : สถานที่ซึ่งทุกๆ คนจะส่งเสียง โดยไม่มีใครฟังและไม่มีใครยอมรับอะไร
  • เจ้านาย : ใครบาง คนที่ชอบมาทำงานเช้าในวันที่คุณเข้างานสาย และก็มาซะสายในวันที่คุณมาเช้า
  • อาชญากร : ก็เหมือน คนเราๆ ท่านๆ นี่แหละ เพียงแต่ถูกจับได้
  • นักการทูต : คนที่บอกให้คุณไปลงนรกได้ด้วยวิธีพูด ที่ทำให้คุณอยากไปแทบจะรอไม่ ไหว
  • หมอ : คนที่ช่วยชีวิตคุณด้วยยาและฆ่าคุณทีหลังด้วย บิลค่ารักษา
  • ทนายความ : คนที่ยื่นมือเข้าช่วยคนทำผิด กฎหมาย อย่างถูกต้องตามกฎหมาย
  • นักโฆษณา : คนที่รู้จัก เลือกพูดแต่ความจริงเกี่ยวกับสินค้า หรือบริการเฉพาะครึ่งที่ดี
  • นักร้องวัยรุ่น : เด็กหนุ่มสาวที่มีหน้าตาเป็นอาวุธ และเครื่องแต่ง เสียงกับ sound engineerเป็นเพื่อนตาย
  • หมอดูลายมือ : คนแปลกหน้าที่สามารถจับมือแฟนคุณได้ต่อหน้าต่อตา โดยไม่โดน…
  • ข่าวลือ : สิ่งที่มีประสิทธิภาพไวกว่าแสง
  • ประสบการณ์ : ชื่อที่มนุษย์ตั้งให้กับความผิดพลาดที่ทำในอดีต
  • หาว : จังหวะเดียวในชีวิตที่ผู้ชายที่แต่งงานแล้ว บางคน มีโอกาสได้อ้าปาก
Posted by: ทวี | กุมภาพันธ์ 22, 2007

ทดสอบ ทดสอบ

ลองดู

หมวดหมู่