Html image link, not working
Posted
by
Anders Metnik
on Stack Overflow
See other posts from Stack Overflow
or by Anders Metnik
Published on 2012-07-04T09:32:59Z
Indexed on
2012/07/04
15:16 UTC
Read the original article
Hit count: 207
Hey I'm doing some testing while learning js + html5 and other web/mobile frameworks.
I have a problem with one of my picture links, which I also need to change the picture dynamically and the target(hopefully). But it won't work.
HTML:
<div data-role="content" id="firstPageContent">
<p>I'm first in the source order so I'm shown as the page.</p>
<p>View internal page called <a href="#second">second</a></p>
<a href = "#second" id="mapLink" name="mapLink"><img id="mapLinkImage" alt="a map which links to the mapPage" src="images/main_header.png"/></a>
<Button id="loadButton" onClick="load()"/>
</div><!-- /content -->
js:
importScripts(dataManager.js);
var mapLink=second;
function load(){
alert('called');
document.getElementById('mapLinkImage').src="images/store.map.png";
document.getElementById('mapLink').href = "http://google.com";
}
problem: It ain't showing the image as a link, just as a plain image. i think this will work now.
© Stack Overflow or respective owner