html - javascript - get img src -
if have img in index.html:
<script src="script/script.js" type="text/javascript"></script> <img id="imgb" src="picture/banner1.jpg" border="0"> then in separate file, such gallery.html, need src element of img in index.html.
i tried writing function:
function imgbbs(){ var x = document.getelementbyid('imgb').src; document.getelementbyid('imgbb').src = x; } then try using in gallery.html:
<script src="script/script.js" type="text/javascript"></script> <body onload="imgbbs()"> <img id="imgbb" src="" border="0"> but doesn't seem working. how can src attribute of img in different file?
a way load partial part of index page using jquery this:
$( "#your_image_container_in_gallery.html" ).load( "index.html #imgb" );
Comments
Post a Comment