자기가 쓴 꼬불꼬불한 Js는 프로토타입과 allay를 활용합니다.
10406 단어 prototype
var
qq
=
{};
qq.extend
=
function
(first, second) {
for
(
var
prop
in
second) {
first[prop]
=
second[prop];
}
};
qq.FileUploaderBasic
=
function
(o) {
this
._options
=
{
data:
false
,
url:
false
,
msg: { typeerror:
"
"
,
sizeerror:
"
"
,
maxfile:
"
"
}
};
qq.extend(
this
._options, o);
this
._handler
=
this
._CreateUploadHandle();
this
._button
=
this
._CreateButton();
//
this._preventLeaveInProgress();
};
qq.FileUploader
=
function
(o) {
qq.FileUploaderBasic.apply(
this
, arguments);
qq.extend(
this
._options, {
element:
null
,
template:
"
<div></div>
"
});
qq.extend(
this
._options, o);
this
._element
=
this
._options.element;
this
._template
=
this
._options.template;
};
qq.UploadHandlerForm
=
function
(o) {
//
};
qq.UploadHandlerForm.prototype
=
{
upload:
function
(id, params) {
this
._upload();
}
};
qq.extend(qq.UploadHandlerForm.prototype, {
_upload:
function
(id) {
alert(
"
upload
"
);
}
});
qq.FileUploaderBasic.prototype
=
{
_CreateUploadHandle:
function
() {
var
handlerClass, self
=
this
;
handlerClass
=
"
UploadHandlerForm
"
;
var
_handler
=
new
qq[handlerClass]()
||
{};
return
_handler;
},
_CreateButton:
function
() {
var
self
=
this
;
var
input
=
document.createElement(
"
input
"
);
input.setAttribute(
"
type
"
,
"
button
"
);
input.setAttribute(
"
id
"
,
"
inputfile
"
);
$(input).click(
function
() {
self._handler.upload();
});
$(document.body).append($(input));
return
input;
},
_preventLeaveInProgress:
function
() { }
};
qq.extend(qq.FileUploader.prototype, qq.FileUploaderBasic.prototype);
qq.extend(qq.FileUploader.prototype, {
/*
*
* delegate click event for cancel link
*
*/
_bindCancelEvent:
function
() {
}
});
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
5분 안에 Javascript로 프로토타입 만들기JavaScript는 객체 지향 언어이며 : Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", ...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.