2011-07-28 26 views

回答

1

這裏有一種方法:

HTML

<p id="a">Some text</p> 

CSS

p{text-decoration:line-through;} 

JS

var p = document.getElementById('a') 
p.style.textDecoration = 'none'; 

http://jsfiddle.net/jasongennaro/nVeGB/

-1

設置文本裝飾無

document.getElementById(divID).style.removeAttribute("textDecoration",false)可以去除textDecoration形成風格(在IE工程)

+0

textDecoration不是一個屬性 – Phil

+0

如果你不確定它是如何工作的,不要編寫代碼。 – shabunc

+0

我的代碼正在工作,但可悲的是隻有IE瀏覽器.... – f1r3Ph03n1xX

0

的Javascript:document.getElementById(element_id).style.textDecoration = "none"

jQuery的:$('#element_id').css("text-decoration", "none");

0

設定文字修飾爲無行爲ually稍微好一些,然後將文本修飾設置爲「」。 $(「div」).css(「text-decoration」,「」)

不同之處在於通過設置爲空字符串,您實際上刪除了js-setted屬性。 說,你的元素最初有text-decoration: "underline"(在CSS中,在你使用jQuery設置值之前)。將其設置爲「無」將是錯誤的。刪除財產將是很好的。