超过长度截掉并加“。。。”:
text-overflow:ellipsis;
white-space:nowrap;
width:220px;
text-decoration:none;
overflow: hidden;
height:38px;
分散对齐:
text-align:justify;
text-justify:distribute-all-lines;
text-align-last:justify;
text-indent:10px;
报对象不支持此属性或方法不一定是你浏览器或js版本真的发生问题
很可能是你的对象名与触发事件名起了同名了
如:
<input type="checkbox" name="allCheck" value="" οnclick="allCheck('fileds')">全选时会发生错误,只要将name后的allCheck名字改了,或者将函数名改了就可以正确运行了.
xxxform.submit();时候 name的值也不可以写为submit 否则也会报错!
document.activeElement.id; 获得当前焦点的控件ID
加入收藏:
function addfavorite(){
switch(getOs()){
case 6:window.external.addToFavoritesBar(location.href,document.title,'slice');break;
case 1:window.external.addFavorite(location.href,document.title);break;
case 2:window.sidebar.addPanel(document.title, location.href, "");break;
case 0:alert("无法识别浏览器");break;
}
}
function getOs(){
var ua = navigator.userAgent;
if(ua.indexOf("MSIE 8")>0)return 6;
if(ua.indexOf("MSIE")>0)return 1;
if(isFirefox=ua.indexOf("Firefox")>0)return 2;
if(isSafari=ua.indexOf("Safari")>0)return 3;
if(isCamino=ua.indexOf("Camino")>0)return 4;
if(isMozilla=ua.indexOf("Gecko/")>0)return 5;
return 0;
}
JS错误解决方法:
HKEY_CLASSES_ROOT\TypeLib\{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}\1.1\0\win32
将
C:\WINDOWS\system32\shdocvw.dll 改为
C:\WINDOWS\system32\ieframe.dll