改alert^o^ (function () { var a = window.alert; window.alert = function (v) { if (v == "事件a") a("事件b"); a(v); } })(); function afun () { alert('事件a'); } </script> <button onclick="afun();">按钮</button>
不是,楼主是说上面的语句不用动就行了。呵呵。 afun再赋值还是可以的。
用事件附加的模式: <input id="mm" type=button value=button1 onclick="afun()"><script> function afun() { alert('事件a'); } function bfun() { alert('事件b'); }document.getElementById("mm").attachEvent("onclick", bfun); </script>
(function () {
var a = window.alert;
window.alert = function (v) {
if (v == "事件a")
a("事件b");
a(v);
}
})();
function afun () {
alert('事件a');
}
</script>
<button onclick="afun();">按钮</button>
afun再赋值还是可以的。
<input id="mm" type=button value=button1 onclick="afun()"><script>
function afun()
{
alert('事件a');
}
function bfun()
{
alert('事件b');
}document.getElementById("mm").attachEvent("onclick", bfun);
</script>
这个。。能实现不?
http://community.csdn.net/Expert/topic/5255/5255447.xml?temp=.9793054
大致代码如下<input id="orderend" type="text" name="orderend" runat="server"> <input onclick="calendar(document.Form1.orderend)" type="button" value="添加时间" name="Submit1">其中设置 WebCalendar.timeShow = false;现在,当我点击按钮出现日期选择框,点击我要的日期,文本框 orderend 里就出日期例如“2005-06-06”,
我有一个js函数是设置相关对象时间值的 function setTailTime(obj, setValue)
{
var objValue = obj.value;
if(objValue == "")return;
if(setValue == null || setValue == "")
obj.value = objValue + " 00:00:00";
else
{
if(objValue.indexOf(" ")>0)
objValue = objValue.substring(0, objValue.indexOf(" "));
obj.value = objValue + " " + setValue;
}
}现在我这个函数怎么使用?
则会替换事件
-----用事件附加的模式:<input id="mm" type=button value=button1 onclick="afun()"><script>
function afun()
{
alert('事件a');
}
function bfun()
{
alert('事件b');
}document.getElementById("mm").attachEvent("onclick", bfun);
</script>