I don’t know how simple this would be but I am trying to figure out how to call a function from a function.
I have an JavaScript to show a DIV on a Page and I have another JavaScript that uses a appenchild to call an image. My problem is that I cant have that image loaded before the first JavaScript is executed. This is more than just display or not the image before, I need the image to be called only after the first JavaScript is loaded.
The image is a dynamically generated and is used to track the action of showing the DIV. If I let the browser load the image before the action it defeat the tracking purpose.
the the code I want to load after the DIV is loaded:
function MonitorDIVExpand() {
var img = document.createElement('img');
img.src = "http://dynamically generated image";
ClickExpandArea.appendChild(img);
}
and this is the one that shows de DIV:
function ShowDIV() {
document.getElementById('div').style.clip='rect(0px, ' + width_xp + 'px, ' + height_xp + 'px, 0px)';
document.getElementById('div').style.width=width_xp + 'px';
document.getElementById('div').style.display='block';
document.getElementById('div').style.overflow='visible';
}
And then I have this div to call the image:
<div id="ClickExpandArea"></div>
Is that a way to do this???
thank you in advance guys.
Just add
MonitorDIVExpand()at the end ofShowDIV()(just before the closing})