开发者

Use Javascript to make Image visible when page opens

I'm looking for Javascript that will fire when page opens and sets Image1 visibility to true.

Thank开发者_开发知识库s


If you are referencing the CSS visibility property:

window.onload = function() {

    document.getElementById( 'Image1' ).style.visibility = "visible";`

};

or the display property:

window.onload = function() {

    document.getElementById( 'Image1' ).style.display = "block";

};


If you want it to occur right away utilize the document.onload method. I.e.

document.onload = loadFunc;

function loadFunc() {
document.getElementById( 'Image1' ).style.display = "block";
}


<script>
window.onload = function() {
    document.getElementById("Image1").visibility = "visible";
}
</script>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜