开发者

How do I make an image overwrite text within another div upon hover of first div?

How do I make an image overwrite text within another div upon hove开发者_开发百科r of first div? ? Any help greatly appreciated.


window.onload = function () { // ensure that we don't try to get div1 before it's loaded
    document.getElementById("div1").onmouseover = function () {
        document.getElementById("div2").innerHTML = "<p>new HTML</p>";
    };
};

Depending on your case, you may wish to use the innerText property to ensure that you don't accidentally make HTML, or you can use the DOM to make new elements.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜