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="javascrip t:test();">Test </a>
</div>
</body>
<script language="javas cript">
function test(){
var image = document.create Element('img');
var a = document.create Element('a');
image.src = 'boating.jpg';
a.id = 'aID';
image.id = 'imageID';
document.getEle mentById("abc") .appendChild(a) ;
document.getEle mentById("aID") .appendChild(im age);
// document.getEle mentById("hID") .href = "javaScript:win dow.open('boati ng.jpg','','wid th=600,height=5 00, resizable=yes, scrollbars=yes' );"; //--->when i do this the original page gets lost
document.getEle mentById("aID") .href = '#'; // --->done for keeping the original page intact
document.getEle mentById("aID") .onclick = "javaScript:win dow.open('boati ng.jpg','','wid th=600,height=5 00, resizable=yes, scrollbars=yes' );"; //--->this script is not working
}
</script>
</html>[/HTML]
[HTML]<html>
<body>
<div id="todiv">
<table >
<tr >
<td id="abc"></td>
</tr>
</table>
<a href="javascrip t:test();">Test </a>
</div>
</body>
<script language="javas cript">
function test(){
var image = document.create Element('img');
var a = document.create Element('a');
image.src = 'boating.jpg';
a.id = 'aID';
image.id = 'imageID';
document.getEle mentById("abc") .appendChild(a) ;
document.getEle mentById("aID") .appendChild(im age);
// document.getEle mentById("hID") .href = "javaScript:win dow.open('boati ng.jpg','','wid th=600,height=5 00, resizable=yes, scrollbars=yes' );"; //--->when i do this the original page gets lost
document.getEle mentById("aID") .href = '#'; // --->done for keeping the original page intact
document.getEle mentById("aID") .onclick = "javaScript:win dow.open('boati ng.jpg','','wid th=600,height=5 00, resizable=yes, scrollbars=yes' );"; //--->this script is not working
}
</script>
</html>[/HTML]
Comment