Developer Notes for prototype.js
Quick guide to somewhat advanced JavaScript http://www.sergiopereira.com/articles/advjs.html
Developer Notes for prototype.js
http://www.sergiopereira.com/articles/prototype.js.html
Advance javascript link(Quick guide to somewhat advanced JavaScript)
Quick guide to somewhat advanced JavaScript http://www.sergiopereira.com/articles/advjs.html
Advance javascript link(Quick guide to somewhat advanced JavaScript)
Quick guide to somewhat advanced JavaScript
Advance javascript link(Quick guide to somewhat advanced JavaScript)
Quick guide to somewhat advanced JavaScript
js object.
var x = {v1:5, v2:6}
alert(x.v1); // alert(5);
อธิบาย x เป็น object (unnamed class)
มี property v1 กับ v2
ก็เลยใช้ . ในการอ้าง
ทีนี้
var x = {};
x.v3 = 6;
alert(x.v3); // ไม่ error แต่จะเ็ป็น alert(6);
เป็นการสร้าง property ขึ้นมากลางอากาศ จากนั้นจะอ้างถึงได้ตลอด
var x = {};
x.y = {};
x.y.z = function() {
alert(’Hello World’);
}
var o = new x.y.z();
AJAX Grids, Tables
55. Data Grids with AJAX, DHTML and JavaScript | Smashing Magazine
56. Grid3 Example
57. AJAX Table Sort Script (revisited)
58. AJAX Sortable Tables: from Scratch with MochiKit
59. AJAX TableKit
Re: How to Create Digg Comment Style Sliding DIVs with Javascript and CSS
wrote a nice blog entry on how to make sliding DIVs using Javascript and CSS from scratch without having the overhead of Effects libraries such as script.aculo.us. Long story short, it made it to the front page of Digg, I thought it was cool but I think I can do better, so here it is:
Let’s start with a Javascript object:
function Slide(objId) {
this.obj = document.getElementById(objId);
this.duration = 1;
this.height = parseInt(this.obj.style.height);
return this; }
And we will want two functions to slide our element up and down:
this.up = function() {
this.curHeight = this.height;
this.newHeight = '1'; }
this.down = function() {
this.newHeight = this.height;
this.curHeight = '1'; }
And then we need a function to do the actual work:
this.slide = function() {
var frames = 30 * duration;
// Running at 30 fps
var tIncrement = (duration*1000) / frames;
tIncrement = Math.round(tIncrement);
var sIncrement = (this.curHeight-this.newHeight) / frames;
var frameSizes = new Array();
for(var i=0; i < frames; i++) {
if(i < frames/2) {
frameSizes[i] = (sIncrement * (i/frames))*4;
} else {
frameSizes[i] = (sIncrement * (1-(i/frames)))*4;
}
}
for(var i=0; i < frames; i++) {
this.curHeight = this.curHeight - frameSizes[i];
window.setTimeout("document.getElementById('"+objId+"').style.height='"
+Math.round(this.curHeight)+"px';",tIncrement * i); } }
