我如何检查是否$(this)是div,ul或blockquote?
例如:
if ($(this) is a div) {
alert('its a div!');
} else {
alert('its not a div! some other stuff');
}
Run Code Online (Sandbox Code Playgroud) 什么是Google Closure解决thisJavaScript回调函数中关键字问题的解决方案.它在OO风格编程中非常有用.
在Google Closure中是否存在OOP的约定或样式?
更新 如何在ViewportSizeMonitor处理程序中访问this.darklayer ???
goog.require('goog.dom');
goog.require('goog.events');
goog.require('goog.events.EventType');
goog.require('goog.math.Size');
goog.require('goog.style');
goog.require('goog.dom.ViewportSizeMonitor');
goog.provide('ehsun7b.ajax.AjaxBox');
ehsun7b.ajax.AjaxBox = function (url, containerClass) {
try {
this.url = url;
this.containerClass = containerClass;
var viwportSize = goog.dom.getViewportSize();
this.darklayer = goog.dom.createDom("div", {
"style": "width: " + viwportSize.width + "px;" + "height: " +
viwportSize.height + "px;" +
"background-image: url('css/img/50black.png');" +
"z-index: 1000;" +
"position: absolute;" +
"left: 0px; top: 0px;"
});
var vsm = new goog.dom.ViewportSizeMonitor(); …Run Code Online (Sandbox Code Playgroud)