Use element-id in javascript

pull/5/head
mandlm 2018-11-09 16:51:01 +01:00 committed by Michael Mandl
parent 382a9896cf
commit f103fd05fc
1 changed files with 10 additions and 8 deletions

View File

@ -9,15 +9,17 @@
background: url({{ url_for("static", filename="loading.gif") }}) 50% no-repeat;
}
</style>
<script>
var downloadingImage = new Image();
downloadingImage.onload = function(){
document.images[0].src = this.src;
};
downloadingImage.src = "{{ url_for("random_image") }}";
</script>
</head>
<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>
</html>