【发布时间】:2011-06-22 09:21:02
【问题描述】:
function jsarea3() { document.getElementById("Txtarea3").title = document.getElementById("Txtarea3").value; }
function jsarea4() { document.getElementById("Txtarea4").title = document.getElementById("Txtarea4").value; }
function jsarea5() { document.getElementById("Txtarea5").title = document.getElementById("Txtarea5").value; }
上面的代码是在鼠标悬停时在文本框区域显示数据。 如您所见,所有 3 个函数的运行代码都相同,区别仅在于 ID 如何动态传递 ID 就像我可以将内部代码用作所有 3 的函数以及如何使用它
像下面给出的代码这样的代码呢
$('#button1').focus(function () {
$('#button1', window.parent.document).css("background-color", "#fcc63b");
}
});
【问题讨论】:
标签: javascript html asp.net-mvc model-view-controller asp.net-mvc-2