日期:2014-05-16  浏览次数:20320 次

jquery javascript 框架编写格式
$.fn.Poshytip = function (option) {
	var defaults = {tag:"newTAG"};
	defaults = $.extend(option, defaults);
	alert(defaults.tag);
	
	//var可有可无,也可以写成this.init 在调用时要用this.init调用,尽量不要用关键命名
	var init = function () {
		alert("init");
	};
	function inits() {
		alert("inits");
	}
	init();
	inits();
};
//JavaScript对象
function funF() {
	this.f = "123";
	this.fun = function () {
		alert(this.f);
	};
}
funF.prototype = {init:function () {
	alert("init");
}};
var fun = new funF();
fun.fun();
fun.init();


function sDialog() {
};
sDialog.fn = sDialog.prototype = {version:"4.1.2", dialog:function (aa) {
	$("#Form").remove();
	$("body").append(aa.a);
	aa.ok();
}};
var sDialog = new sDialog();

sDialog.snake = function () {
	alert("snake");
};
function test() {
	sDialog.snake();
}

function aa() {
	sDialog.dialog({a:$("#Form").clone(true), b:"::999", ok:function () {
		alert("success");
	}});
}