Use element-id in javascript

This commit is contained in:
mandlm 2018-11-09 16:51:01 +01:00 committed by Michael Mandl
parent 382a9896cf
commit f103fd05fc

View File

@ -9,15 +9,17 @@
background: url({{ url_for("static", filename="loading.gif") }}) 50% no-repeat; background: url({{ url_for("static", filename="loading.gif") }}) 50% no-repeat;
} }
</style> </style>
<script>
var downloadingImage = new Image();
downloadingImage.onload = function(){
document.images[0].src = this.src;
};
downloadingImage.src = "{{ url_for("random_image") }}";
</script>
</head> </head>
<body bgcolor="black"> <body bgcolor="black">
<img src="{{ url_for("static", filename="clear.gif") }}" /> <img id="slider" src="{{ url_for("static", filename="clear.gif") }}" />
<script>
var downloadingImage = new Image();
downloadingImage.onload = function()
{
document.getElementById("slider").src = this.src;
};
downloadingImage.src = "{{ url_for("random_image") }}";
</script>
</body> </body>
</html> </html>