0

I am trying to place the image in the middle of the screen but in IE it's not working

here is my sample code.

function showMap(event, url, element)
{
        var map_container = $('map_container'),
        viewport = document.viewport.getDimensions(),
        offset = $(element).viewportOffset(),
        top = offset.top + getScrollTop() + $(element).getHeight() + 10,
        image_mapgross = $('image_mapgross');
        image_mapgross.onload = middleMap;
        image_mapgross.src = url;
        map_container.style.cssText = "display:block;left:10px;top:" + top + "px;";

        Event.stop(event);
        //Event.observe(map_container, 'click', stopEvent);
}

in IE the function middleMap is never called.

function middleMap() {

    var map_container = $('map_container');
    middle(map_container);
}
Sonal Khunt
  • 1,876
  • 12
  • 20
user991047
  • 315
  • 4
  • 12

2 Answers2

0

use writeAttribute() method to set attributes with prototype

 $('image_mapgross').writeAttribute('src', url);

OLD: you need to get a DOM element first

image_mapgross = $('image_mapgross').get(); //or  $('image_mapgross')[0]

if you want to set it events and properties using dot notation

image_mapgross.onload = middleMap;
image_mapgross.src = url;
Irishka
  • 1,136
  • 6
  • 12
0

in IE if i set the source like this

image_mapgross.setAttribute("src", url);

then it works.

user991047
  • 315
  • 4
  • 12