XML 地图
";
},
getFormData: function (ele) {
var copy = ele.clone();
var copiedInputs = $("input,select,textarea", copy);
$("input,select,textarea", ele).each(function (i) {
var typeInput = $(this).attr("type");
if ($.type(typeInput) === 'undefined') {
typeInput = $(this).is("select") ? "select" : $(this).is("textarea") ? "textarea" : "";
}
var copiedInput = copiedInputs.eq(i);
if (typeInput == "radio" || typeInput == "checkbox") {
copiedInput.attr("checked", $(this).is(":checked"));
} else if (typeInput == "text") {
copiedInput.attr("value", $(this).val());
} else if (typeInput == "select") {
$(this).find("option").each(function (i) {
if ($(this).is(":selected")) {
$("option", copiedInput).eq(i).attr("selected", true);
}
});
} else if (typeInput == "textarea") {
copiedInput.text($(this).val());
}
});
return copy;
},
getPrintWindow: function () {
switch (settings.mode) {
case modes.iframe:
var f = new PrintArea.Iframe();
return { win: f.contentWindow || f, doc: f.doc };
case modes.popup:
var p = new PrintArea.Popup();
return { win: p, doc: p.doc };
}
},
Iframe: function () {
var frameId = settings.id;
var iframeStyle = 'border:0;position:absolute;width:0px;height:0px;right:0px;top:0px;';
var iframe;
try {
iframe = document.createElement('iframe');
document.body.appendChild(iframe);
$(iframe).attr({ style: iframeStyle, id: frameId, src: "#" + new Date().getTime() });
iframe.doc = null;
iframe.doc = iframe.contentDocument ? iframe.contentDocument : (iframe.contentWindow ? iframe.contentWindow.document : iframe.document);
} catch (e) {
throw e + ". iframes may not be supported in this browser.";
}
if (iframe.doc == null) {
throw "Cannot find document.";
}
return iframe;
},
Popup: function () {
var windowAttr = "location=yes,statusbar=no,directories=no,menubar=no,titlebar=no,toolbar=no,dependent=no";
windowAttr += ",width=" + settings.popWd + ",height=" + settings.popHt;
windowAttr += ",resizable=yes,screenX=" + settings.popX + ",screenY=" + settings.popY + ",personalbar=no,scrollbars=yes";
var newWin = window.open("", "_blank", windowAttr);
newWin.doc = newWin.document;
return newWin;
}
};
})(jQuery);