I am writing an Open University project that requires me to use Cordova to generate an Android app. To do this, I am using a combination of HTML and JavaScript.
My HTML uses
<div data-role="page" id="view">
etc. to define individual pages within the single HTML file. When the page first runs, it shows a "corporate" logo. After signing in, it shows the personal logo. The url to the logo comes from a database and is held in a JS global variable railroadLogoPath. I have an HTML placeholder Once I move to another page, I can't see how to get the HTML to use the JS to get the url of this logo.
My HTML looks like this:
<img class="banner" id = "signedInlogo" width = "100%">
I have a JS function in index.js as follows:
function insertLogo(anID) {
document.getElementById("anID").src = railroadLogoPath;
}
How do I call this from HTML. I have tried putting it in
<script> insertLogo("signedInLogo")</script>
but this doesn't work.
I am just starting to understand JS so any help would be appreciated. David
document.getElementById("anID").src = railroadLogoPath;todocument.getElementById(anID).src = railroadLogoPath;