Hello,
I have following HTML page (index.html)
Code:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 STRICT//EN" "DTD/xhtml1-strict.dtd"> <HTML> <HEAD> <TITLE></TITLE> <LINK rel=stylesheet type=text/css href="css/bwc.css"> <SCRIPT type=text/javascript src="jscript/twoway.js"></SCRIPT> <SCRIPT type=text/javascript src="jscript/functions.js"></SCRIPT> <SCRIPT type=text/javascript src="jscript/refresh.js"></SCRIPT> <SCRIPT type=text/javascript> var useUDP = false; var myGUIGroup = 'NewGUIGroup'; function loadWebImages(){ var img; img = document.getElementById('img0'); if (img){ img.src = 'http://192.168.0.252/images1sif'; } } </SCRIPT> </HEAD> <!-- bwc generated code start --> <BODY BGCOLOR="Black" style="WIDTH:640px; HEIGHT:480px; sPOSITION: absolute; MARGIN-TOP: 0px; MARGIN-LEFT: 0px; -webkit-user-select: none;" onorientationchange = onRotate(orientation); onunload=allowAJAX=false; > <IMG style="POSITION:absolute; TOP:24px; LEFT:32px; WIDTH:564px; HEIGHT:427px;" id="imgPL0" src="images/webImgPlaceholder.jpg" alt="Web Image" > <!-- 03.13.2011 04:15:48 --> <IMG style="POSITION:absolute; TOP:24px; LEFT:32px; WIDTH:564px; HEIGHT:427px;" id="img0" src="" alt="Web Image" > <!-- 03.13.2011 04:15:48 --> <!-- bwc generated code end --> </BODY> </HTML>
and a .js files called refresh.js
The code above will refresh the image all the time. (that's what I want)Code:<!-- function refresh(){ var image = "http://192.168.0.252/images1sif" document.images["img0"].src=image+"?"+new Date(); setTimeout('refresh()', 120);} if(document.images)window.onload=refresh; // -->
However, as you can see in the js file 'var image = http://...' I want to get the URL of the image from the index.html page (img.src = 'http://...)
Code:var image = "http://192.168.0.252/images1sif"I know it has src="" but I want to read it from the function loadWebImagesCode:<IMG style="POSITION:absolute; TOP:24px; LEFT:32px; WIDTH:564px; HEIGHT:427px;" id="img0" src="" alt="Web Image" >
The index.html page gets created from a program which we can't edit so everything needs to be done from the refresh.js file.Code:function loadWebImages(){ var img; img = document.getElementById('img0'); if (img){ img.src = 'http://192.168.0.252/images1sif'; }
I have trying to find a way but can't work it out.
Can someone help me out with this?
Aaron.


Reply With Quote
