超過長度截掉並加“。。。”:
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