Hello,
I am trying to get a image to load into a src tag from a value from a function. can someone steer me in the right direction here? here is some sample code.
<div id="layer1" style="position: absolute; width: 1193px; height: 691px; z-index: 1; top: 46px; left: 11px">
<iframe name="I1" id="I1" src = PlaceToPostSnapshot style="width: 1112px; height: 664px">" class="style2" style="height: 642px; width: 1061px"Your browser does not support inline frames or is currently configured not to display inline frames.
</iframe></div>
// function to display alarm jpg
function getImage()
{
var @AlarmDate = 1;
var image = @AlarmDate.value + ".jpg"
document.getElementByTagName('PlaceToPostSnapshots').setAttribute('src', image)
}
You misunderstand getElementsByTagname(). Yes, it's elements, plural. And in the parenthesis you should have the element name, iframe in this case. But it won't work anyway because it rerurns a collection of all elements of this type on the page.
It's enough to do it like this.
I tried your suggestions but they didn't work. As far as using the iframe, that's what i was given to use. I do get a collection of all the jpg when using the current script i have. In Firefox when clicking on one of the jpg it will open in the iframe, but in IE it opens in a separate window. How can i get the image to open in the iframe in IE and not open in a separate program?
A little more back ground on what i'm trying to accomplish.
This will help for one page, i have two pages with the same template that need to run. One that shows all the collections and then opens the jpg selected.
The other page gets a jpg from a alarm event that is triggered. The @AlarmDate is a macro from another program that calls the html page to load when the user clicks on it. There could be more than one alarm event by the time the operator replies so i want to make sure that the correct jpg opens for each alarm. Which is why i'm trying to use the @AlarmDate variable.
BTW i got rid of the iframe
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)