var tt=function(obj)
{
return function()
{
alert(obj.tagName); //It can be an execution function defined externally;
}
}
function addfunction()
{
var bigobj=document.getElementById("mytable");
var rows =bigobj.rows;
for(var j=0; j{
for(var i=0;i{
rows[j].cells[i].attachEvent("onmousemove",tt(rows[j].cells[i ]));
//rows[j].cells[i].onmousemove = function(){
// tt();
//}
}
}
}
========== Compatible with FF and IE writing
function addEvent (o,c,h){
if(o.attachEvent){
o.attachEvent('on' c,h);
}else{
o.addEventListener(c,h,false);
}
return true;}
var tt=function(obj)
{
return function (){textChange(obj);}
}
addEvent(input1,"change",tt(input1));
function textChange(o)
{
// do something
}
Use Jquery to do it in one sentence
$("input[type='text']").change( function() {
// You can write some verification code here
});
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn