function printEvent(evt)
{
try
{
var tmp = '';
for(var i in evt)
{
tmp += i+':'
var v = evt[i]+'';
if(v=='[object HTMLDivElement]')
{
tmp+=' <b>div</b> - '+evt[i].id+'<br/>';
}
else if(''+(evt[i])=='[object TouchList]')
{
tmp+=' <br/> <b>touchlist</b>:<div style="border:1px solid red; margin:1px"> ';
for(var x in evt[i])
{
if(''+(evt[i][x])=='[object Touch]')
{
tmp+='<br> ----'+x+':'+' <b>Touch</b><br/><div style="border:1px solid blue;margin:1px">';
for(var y in evt[i][x])
{
if(evt[i][x][y]=='[object HTMLDivElement]')
{
tmp+=' ----'+y+':<b>div</b> - '+evt[i][x][y].id+'<br/>';
}else tmp+='<br> ----'+y+':'+evt[i][x][y]+'<br/>';
}
tmp+='</div>';
}else
tmp+='<br> '+x+':'+evt[i][x]+'<br/>';
}
tmp+='</div>';
}else if(typeof(evt[i])=='number'){
tmp+='<font color="green">'+v+'</font><br/>';
}
else tmp+=''+v+'<br/>';
}
return tmp;
}catch(e){
alert(e)
}
}
转载于:https://www.cnblogs.com/lein317/archive/2012/06/26/5067628.html