我想改變使用javascript的HTML元素內的另一種風格。如何改變使用javascript內嵌的另一個元素的風格?
我已經使用下面的代碼來改變當前的html元素。
<p onmouseover="this.style.color = 'black;">This text should be changed</p>
<h1>How to change this element when hovered on p element</h1>
我想使用javascript更改p標記內的其他元素的樣式。
任何人都可以幫忙嗎?
的可能的複製[添加使用JavaScript內嵌樣式(http://stackoverflow.com/questions/14753147/add-inline-style-using-javascript) –
與問題不明確... –
爲什麼用js簡單的用css'p:hover + h1 {「添加你的風格}' – prasanth