5

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
  • 331,213
  • 40
  • 305
  • 339
sajid
  • 247
  • 7
  • 15

1 Answers1

2

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
  • 331,213
  • 40
  • 305
  • 339