I have an element that already has a class: 我有一個已經有一個類的元素: html
<div class="someclass"> <img ... id="image1" name="image1" /> </div>
Now I want to create a JavaScript function that will add a class to the div
(not replace, but add). 如今,我想建立一個JavaScript函數,該函數將向div
添加一個類(不是替換,而是添加)。 ide
How can I do that? 我怎樣才能作到這一點? 函數