Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

open a new window and image in it !!

Status
Not open for further replies.

armandoxxx

Programmer
Nov 28, 2000
3
SI
hello ..
I need help with a problem I'm trying to solve for some time now.
task: I want to click on a picture in my browser and it would open a new window and a picture in it. Here are problem: well, first I want this window to be sizeed as image not biger not smaller, next I would like check if this window was aready open .. since I have my code and it is not working.. I would like, if anyone can, write me the code to solve this problem !!! I'm a beginer in JavaScript and would realy appreciate it !!
10x

Armando
 
<script>
x=null
function windowManager(img)
{
if(x!=null)
{
if(x.closed)
{
showImage(img)
}
else{x.focus()}
}
else{showImage(img)}
}

function showImage(img)
{
var h,w,options
w = img.width;
h = img.height;
options = &quot;height=&quot;+h+&quot;,width=&quot;+w
x=window.open(&quot;&quot;,&quot;imgwin&quot;,options);
x.document.write('<body leftmargin=0 topmargin=0><img src=&quot;back.gif&quot; width=300 height=300></body>')
}
</script>
</head>
<body marginwidth=&quot;0&quot; marginheight=&quot;0&quot;>
<img src=&quot;back.gif&quot; width=300 height=300 onClick=&quot;windowManager(this)&quot;>
</body> jared@aauser.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top