开发者

Use Javascript to make Image visible when page opens

开发者 https://www.devze.com 2022-12-28 20:58 出处:网络
I\'m looking for Javascript that will fire when page opens and sets Image1 visibility to true. Thank开发者_开发知识库sIf you are referencing the CSS visibility property:

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

精彩评论

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