function setPlaceholder(e) {
var placeholder = $(this).attr('placeholder');
if ($(this).val().length == 0) {
$(this).css("color", "#b2b2b2").val(placeholder);
}
$(this).focus(function (e) {
if ($(this).val() == placeholder) { $(this).css("color", "#666").val(""); }
});
$(this).blur(function (e) {
if ($(this).val().length == 0) { $(this).css("color", "#b2b2b2").val(placeholder); }
});
}
if (Is_LTE_IE9) {
$('input[placeholder]').each(setPlaceholder);
$('textarea[placeholder]').each(setPlaceholder);
}
function getOffset(e) { /*e: Mousemove Event*/ if (e.target.offsetLeft == undefined) { /*firefox only*/ e.target = target.parentNode; } var tarPos = getTarPos(e.target); var tarMousePos = { x: window.pageXOffset + e.clientX, y: window.pageYOffset + e.clientY }; var offset = { offsetX: tarMousePos.x - tarPos.x, offsetY: tarMousePos.y - tarPos.y }; return offset; } function getTarPos(el) { var page = { x: 0, y: 0 }; while (el) { page.x += el.offsetLeft; page.y += el.offsetTop; el = el.offsetParent; } return page; }
1.檢查 form 是否設定 Id 及 name
2.加上<input type="submit" style="display:none"/>