现在代码:
if( document.getElementById( "name ") )
{
document.getElementById( "div_name_ ").innerHTML = "Please Insert Name! " ;
document.getElementById( "name ").focus();
return false;
}
想改为:
----------------------------
var dg = document.getElementById
if( dg( "name ") )
{
dg( "div_name_ ").innerHTML = "Please Insert Name! " ;
dg( "name ").focus();
return false;
}
----------------------------
在IE下好用,FF下所有效果丢失
------解决方案--------------------
var dg = function(id){return document.getElementById(id);} 试试