3

I have the below code on one page:

<div id="prodoneid" class="prodcls">
    <a href="javascript:void(changeIt('big.png', 'pagewrapid')());">
        <img src="images/zara/thumbnails/1.png" alt="ZARA"/>
    </a>
</div>

By the below code I am opening the image in a new window. The new page is opening but is not showing the image in the div.

var changeIt, img;
changeIt = function(imageName, objName) { 
    img = '<img src="images/zara/' + imageName + '">';
    newwindow = window.open( 'fprod.html', target="_blank" );
    document.getElementById(objName).innerHTML = img;
    setTimeout('newwindow.document.getElementById("pagewrapid").innerHTML=img',0)
};
Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
sajid
  • 227
  • 6
  • 15

1 Answers1

1

You don't need any javascript for this, just add target=_blank to your a element:

<div id="prodoneid" class="prodcls">
    <a href="images/zara/big.png" target="_blank">
        <img src="images/zara/thumbnails/1.png" alt="ZARA"/>
    </a>
</div>
Rory McCrossan
  • 319,460
  • 37
  • 290
  • 318
  • If you want to open the image in a div you need to use a modal dialog. Have a google for that term and you should find something useful. – Rory McCrossan Dec 22 '11 at 10:31