I have a problem regarding open the enlarged image in a new window. What I am facing problem is I have to open put the image in the div from Javascript which I have done well and now what I need is when the user clicks on the image the image should be displayed in a new window. I have also tried this by using href option but when I put the window.open function into the href I original page gives an error which i do not want, I want the original page to be intact just opening the image in a new window. Is there any possible way. Here is what i have so far. Please could anyone customize the code so that I can open the image in a new window. Help greatly appreciated.
[HTML]<html>
<body>
<div id="todiv">
<table >
<tr >
<td id="abc"></td>
</tr>
</table>
<a href="javascript:test();">Test</a>
</div>
</body>
<script language="javascript">
function test(){
var image = document.createElement('img');
var a = document.createElement('a');
image.src = 'boating.jpg';
a.id = 'aID';
image.id = 'imageID';
document.getElementById("abc").appendChild(a);
document.getElementById("aID").appendChild(image);
// document.getElementById("hID").href = "javascript:window.open('boating.jpg','','width=60 0,height=500, resizable=yes, scrollbars=yes');"; //--->when i do this the original page gets lost
document.getElementById("aID").href = '#'; // --->done for keeping the original page intact
document.getElementById("aID").onclick = "javascript:window.open('boating.jpg','','width=60 0,height=500, resizable=yes, scrollbars=yes');"; //--->this script is not working
}
</script>
</html>[/HTML]